You are here

protected function MediaImageTest::setCaption in Entity Embed 8

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

Parameters

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

1 call to MediaImageTest::setCaption()
MediaImageTest::testCkeditorWidgetHasEditableCaption in tests/src/FunctionalJavascript/MediaImageTest.php
Tests caption editing in the CKEditor widget.

File

tests/src/FunctionalJavascript/MediaImageTest.php, line 829

Class

MediaImageTest
Test Media Image specific functionality.

Namespace

Drupal\Tests\entity_embed\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);
}