You are here

protected function CKEditorIntegrationTest::setCaption in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::setCaption()

Sets the text of the editable caption to the given text.

Parameters

string $text: The text to set in the caption.

1 call to CKEditorIntegrationTest::setCaption()
CKEditorIntegrationTest::testEditableCaption in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests caption editing in the CKEditor widget.

File

core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php, line 1443

Class

CKEditorIntegrationTest
@coversDefaultClass \Drupal\media\Plugin\CKEditorPlugin\DrupalMedia @group media

Namespace

Drupal\Tests\media\FunctionalJavascript

Code

protected function setCaption($text) {
  $this
    ->getSession()
    ->switchToIFrame();
  $select_and_edit_caption = "var editor = CKEDITOR.instances['edit-body-0-value'];\n       var figcaption = editor.widgets.getByElement(editor.editable().findOne('figcaption'));\n       figcaption.editables.caption.setData('" . $text . "')";
  $this
    ->getSession()
    ->executeScript($select_and_edit_caption);
}