function CKEditor5HeightTest::isSourceEditingScrollable

Same name and namespace in other branches
  1. 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5HeightTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5HeightTest::isSourceEditingScrollable()

Checks that the source editing element is scrollable.

1 call to CKEditor5HeightTest::isSourceEditingScrollable()
CKEditor5HeightTest::testCKEditor5Height in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5HeightTest.php
Tests editor height respects rows config.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5HeightTest.php, line 112

Class

CKEditor5HeightTest
Tests ckeditor height respects field rows config.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

private function isSourceEditingScrollable() : bool {
  $javascript = <<<JS
    (function () {
      const element = document.querySelector('.ck-source-editing-area textarea');
      const style = window.getComputedStyle(element);
      if (
        element.scrollHeight > element.clientHeight &&
        style.overflow !== 'hidden' &&
        style['overflow-y'] !== 'hidden' &&
        style.overflow !== 'clip' &&
        style['overflow-y'] !== 'clip'
      ) {
        if (
          element === document.scrollingElement ||
          (style.overflow !== 'visible' &&
            style['overflow-y'] !== 'visible')
        ) {
          return true;
        }
      }
  
      return false;
    })();
  JS;
  $evaluateScript = $this->getSession()
    ->evaluateScript($javascript);
  return $evaluateScript;
}

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