protected function TestBase::editorSetSelection in Twig Field 8
Sets CodeMirror document selection.
1 call to TestBase::editorSetSelection()
- TwigFieldTest::testTwigField in tests/
src/ FunctionalJavascript/ TwigFieldTest.php - Test callback.
File
- tests/
src/ FunctionalJavascript/ TestBase.php, line 36
Class
- TestBase
- Base class for Twig field tests.
Namespace
Drupal\Tests\twig_field\FunctionalJavascriptCode
protected function editorSetSelection($anchor, $head) {
$script = 'document.querySelector("#edit-field-template-wrapper .CodeMirror").CodeMirror.setSelection({line: %d, ch: %d}, {line: %d, ch: %d});';
$script = sprintf($script, $anchor[0], $anchor[1], $head[0], $head[1]);
$this
->getSession()
->getDriver()
->executeScript($script);
}