You are here

protected function EntityEmbedTestBase::waitForEditor in Entity Embed 8

Waits for CKEditor to initialize.

Parameters

string $instance_id: The CKEditor instance ID.

int $timeout: (optional) Timeout in milliseconds, defaults to 10000.

9 calls to EntityEmbedTestBase::waitForEditor()
CKEditorIntegrationTest::getCkeditorUndoSnapshotCount in tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Get a CKEditor instance's undo snapshot count.
CKEditorIntegrationTest::testIntegration in tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Test integration with Filter, Editor and Ckeditor.
ContentTranslationTest::testHostEntityLangcode in tests/src/FunctionalJavascript/ContentTranslationTest.php
Tests the host entity's langcode is available in EntityEmbedDialog.
MediaImageTest::testAltAndTitle in tests/src/FunctionalJavascript/MediaImageTest.php
Tests alt and title overriding for embedded images.
MediaImageTest::testCkeditorWidgetHasEditableCaption in tests/src/FunctionalJavascript/MediaImageTest.php
Tests caption editing in the CKEditor widget.

... See full list

File

tests/src/FunctionalJavascript/EntityEmbedTestBase.php, line 62

Class

EntityEmbedTestBase
Base class for all entity_embed tests.

Namespace

Drupal\Tests\entity_embed\FunctionalJavascript

Code

protected function waitForEditor($instance_id = 'edit-body-0-value', $timeout = 10000) {
  $condition = <<<JS
      (function() {
        return (
          typeof CKEDITOR !== 'undefined'
          && typeof CKEDITOR.instances["{<span class="php-variable">$instance_id</span>}"] !== 'undefined'
          && CKEDITOR.instances["{<span class="php-variable">$instance_id</span>}"].instanceReady
        );
      }());
JS;
  $this
    ->getSession()
    ->wait($timeout, $condition);
}