function CKEditor5ReadOnlyModeTest::testReadOnlyModeDynamic

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

Test that the CKEditor 5 read-only mode is set dynamically.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5ReadOnlyModeTest.php, line 116

Class

CKEditor5ReadOnlyModeTest
Tests read-only mode for CKEditor 5.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function testReadOnlyModeDynamic() : void {
  $this->drupalGet('node/add');
  $this->assertSession()
    ->elementAttributeContains('css', '.field--name-field-ckeditor5-disable .ck-editor .ck-content', 'contenteditable', 'true');
  $this->assertSession()
    ->elementAttributeContains('css', '.field--name-field-ckeditor5-enable .ck-editor .ck-content', 'contenteditable', 'false');
  $this->getSession()
    ->getPage()
    ->checkField('field_ckeditor5_toggle[value]');
  $this->assertSession()
    ->elementAttributeContains('css', '.field--name-field-ckeditor5-disable .ck-editor .ck-content', 'contenteditable', 'false');
  $this->assertSession()
    ->elementAttributeContains('css', '.field--name-field-ckeditor5-enable .ck-editor .ck-content', 'contenteditable', 'true');
  $this->getSession()
    ->getPage()
    ->uncheckField('field_ckeditor5_toggle[value]');
  $this->assertSession()
    ->elementAttributeContains('css', '.field--name-field-ckeditor5-disable .ck-editor .ck-content', 'contenteditable', 'true');
  $this->assertSession()
    ->elementAttributeContains('css', '.field--name-field-ckeditor5-enable .ck-editor .ck-content', 'contenteditable', 'false');
}

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