function CKEditorTestTrait::waitForEditor

Same name in other branches
  1. 9 core/modules/ckeditor/tests/src/Traits/CKEditorTestTrait.php \Drupal\Tests\ckeditor\Traits\CKEditorTestTrait::waitForEditor()

Waits for CKEditor to initialize.

Parameters

string $instance_id: (optional) The CKEditor instance ID. Defaults to 'edit-body-0-value'.

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

14 calls to CKEditorTestTrait::waitForEditor()
CKEditorIntegrationTest::testAlignment in core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests alignment integration.
CKEditorIntegrationTest::testAllowedMediaTypes in core/modules/media_library/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests the allowed media types setting on the MediaEmbed filter.
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 20

Class

CKEditorTestTrait
Provides methods to test CKEditor.

Namespace

Drupal\Tests\ckeditor\Traits

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->assertJsCondition($condition, $timeout);
}

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