You are here

protected function CKEditorIntegrationTest::closeContextMenu in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::closeContextMenu()

Closes the open context menu.

Parameters

string $instance_id: The CKEditor instance ID.

1 call to CKEditorIntegrationTest::closeContextMenu()
CKEditorIntegrationTest::testLinkability in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests linkability of the CKEditor widget.

File

core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php, line 1546

Class

CKEditorIntegrationTest
@coversDefaultClass \Drupal\media\Plugin\CKEditorPlugin\DrupalMedia @group media

Namespace

Drupal\Tests\media\FunctionalJavascript

Code

protected function closeContextMenu($instance_id = 'edit-body-0-value') {
  $this
    ->getSession()
    ->switchToIFrame();
  $script = <<<JS
      (function() {
        var editor = CKEDITOR.instances["{<span class="php-variable">$instance_id</span>}"];
        editor.contextMenu.hide();
      }());
JS;
  $this
    ->getSession()
    ->executeScript($script);
}