You are here

public function ThunderJavascriptTestBase::selectCkEditorElement in Thunder 6.1.x

Same name and namespace in other branches
  1. 8.5 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::selectCkEditorElement()
  2. 8.2 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::selectCkEditorElement()
  3. 8.3 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::selectCkEditorElement()
  4. 8.4 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::selectCkEditorElement()
  5. 6.2.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::selectCkEditorElement()
  6. 6.0.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::selectCkEditorElement()

Select CKEditor element.

Parameters

string $ckEditorCssSelector: CSS selector for CKEditor.

int $childIndex: The child index under the node.

3 calls to ThunderJavascriptTestBase::selectCkEditorElement()
ParagraphSplitTest::testAddParagraphAfterSplitDataLoss in tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php
Test if a adding paragraph after split leads to data loss.
ParagraphSplitTest::testParagraphSplitBefore in tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php
Test split of paragraph before a selection.
ParagraphSplitTest::testParagraphSplitDataLoss in tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php
Test if a deleted paragraph leads to data loss.

File

tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php, line 303

Class

ThunderJavascriptTestBase
Base class for Thunder Javascript functional tests.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function selectCkEditorElement($ckEditorCssSelector, $childIndex) {
  $ckEditorId = $this
    ->getCkEditorId($ckEditorCssSelector);
  $this
    ->getSession()
    ->getDriver()
    ->executeScript("let selection = CKEDITOR.instances[\"{$ckEditorId}\"].getSelection(); selection.selectElement(selection.root.getChild({$childIndex})); var ranges = selection.getRanges(); ranges[0].setEndBefore(ranges[0].getBoundaryNodes().endNode); selection.selectRanges(ranges);");
}