function CKEditorTestTrait::assignNameToCkeditorIframe

Same name in other branches
  1. 9 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()
CKEditorIntegrationTest::leaveSourceMode in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Leaves source mode and returns to the CKEditor iframe.
CKEditorIntegrationTest::testAlignment in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests alignment integration.
CKEditorIntegrationTest::testAlt in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests the EditorMediaDialog can set the alt attribute.
CKEditorIntegrationTest::testButton in core/modules/media_library/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests using DrupalMediaLibrary button to embed media into CKEditor.
CKEditorIntegrationTest::testDialogAccess in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Test 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.