function AjaxCssTest::waitOnCkeditorInstance

Same name in other branches
  1. 8.9.x core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\AjaxCssTest::waitOnCkeditorInstance()

Wait for a CKEditor instance to finish loading and initializing.

Parameters

string $instance_id: The CKEditor instance ID.

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

1 call to AjaxCssTest::waitOnCkeditorInstance()
AjaxCssTest::testCkeditorAjaxAddCss in core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php
Tests adding style sheets dynamically to CKEditor.

File

core/modules/ckeditor/tests/src/FunctionalJavascript/AjaxCssTest.php, line 115

Class

AjaxCssTest
Tests delivery of CSS to CKEditor via AJAX.

Namespace

Drupal\Tests\ckeditor\FunctionalJavascript

Code

protected function waitOnCkeditorInstance($instance_id, $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);
}

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