function MediaTest::closeContextMenu

Closes the open context menu.

Parameters

string $instance_id: The CKEditor instance ID.

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

File

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

Class

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

Namespace

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

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