You are here

protected function CKEditorTestTrait::assignNameToCkeditorIframe in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/ckeditor/tests/src/Traits/CKEditorTestTrait.php \Drupal\Tests\ckeditor\Traits\CKEditorTestTrait::assignNameToCkeditorIframe()
  2. 10 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()

12 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);
}