function MediaTest::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 MediaTest::setCaption()
MediaTest::testEditableCaption in core/modules/ckeditor/tests/src/FunctionalJavascript/MediaTest.php
Tests caption editing in the CKEditor widget.

File

core/modules/ckeditor/tests/src/FunctionalJavascript/MediaTest.php, line 1492

Class

MediaTest
@coversDefaultClass \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalMedia @group ckeditor @group legacy

Namespace

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.