function CKEditorTestTrait::assignNameToCkeditorIframe

Same name in other branches
  1. 8.9.x core/modules/ckeditor/tests/src/Traits/CKEditorTestTrait.php \Drupal\Tests\ckeditor\Traits\CKEditorTestTrait::assignNameToCkeditorIframe()

Assigns a name to the CKEditor iframe.

Parameters

string $id: (optional) The id to assign the iframe element. Defaults to 'ckeditor'.

string $instance_id: (optional) The CKEditor instance ID. Defaults to 'edit-body-0-value'.

See also

\Behat\Mink\Session::switchToIFrame()

13 calls to CKEditorTestTrait::assignNameToCkeditorIframe()
MediaLibraryTest::testButton in core/modules/ckeditor/tests/src/FunctionalJavascript/MediaLibraryTest.php
Tests using DrupalMediaLibrary button to embed media into CKEditor.
MediaTest::leaveSourceMode in core/modules/ckeditor/tests/src/FunctionalJavascript/MediaTest.php
Leaves source mode and returns to the CKEditor iframe.
MediaTest::testAlignment in core/modules/ckeditor/tests/src/FunctionalJavascript/MediaTest.php
Tests alignment integration.
MediaTest::testAlt in core/modules/ckeditor/tests/src/FunctionalJavascript/MediaTest.php
Tests the EditorMediaDialog can set the alt attribute.
MediaTest::testDialogAccess in core/modules/ckeditor/tests/src/FunctionalJavascript/MediaTest.php
Tests the EditorMediaDialog's form elements' #access logic.

... See full list

File

core/modules/ckeditor/tests/src/Traits/CKEditorTestTrait.php, line 43

Class

CKEditorTestTrait
Provides methods to test CKEditor.

Namespace

Drupal\Tests\ckeditor\Traits

Code

protected function assignNameToCkeditorIframe($id = 'ckeditor', $instance_id = 'edit-body-0-value') {
    $javascript = <<<JS
(function(){
  CKEDITOR.instances['{<span class="php-variable">$instance_id</span>}'].element.getParent().find('.cke_wysiwyg_frame').\$[0].id = '{<span class="php-variable">$id</span>}';
})()
JS;
    $this->getSession()
        ->evaluateScript($javascript);
}

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