function CKEditorIntegrationTest::openContextMenu

Opens the context menu for the currently selected widget.

Parameters

string $instance_id: The CKEditor instance ID.

1 call to CKEditorIntegrationTest::openContextMenu()
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 1470

Class

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

Namespace

Drupal\Tests\media\FunctionalJavascript

Code

protected function openContextMenu($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.open(editor.widgets.selected[0].element);
      }());
JS;
    $this->getSession()
        ->executeScript($script);
}

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