You are here

protected function AjaxCssTest::waitOnCkeditorInstance in Drupal 9

Same name and namespace in other branches
  1. 8 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 114

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);
}