function EditorAdminTest::testEditorCreation

Same name in other branches
  1. 9 core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php \Drupal\Tests\editor\FunctionalJavascript\EditorAdminTest::testEditorCreation()
  2. 10 core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php \Drupal\Tests\editor\FunctionalJavascript\EditorAdminTest::testEditorCreation()

Tests that editor creation works fine while switching text editor field.

The order in which the different editors are selected is significant, because the form state must change accordingly.

See also

https://www.drupal.org/project/drupal/issues/3230829

File

core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php, line 80

Class

EditorAdminTest
@group editor

Namespace

Drupal\Tests\editor\FunctionalJavascript

Code

public function testEditorCreation() : void {
    $page = $this->getSession()
        ->getPage();
    $assert_session = $this->assertSession();
    $this->drupalGet('/admin/config/content/formats/add');
    $page->fillField('name', $this->randomString());
    $page->selectFieldOption('editor[editor]', 'ckeditor5');
    $this->assertNotEmpty($this->assertSession()
        ->waitForElementVisible('css', 'ul.ckeditor5-toolbar-available__buttons'));
    $page->selectFieldOption('editor[editor]', '');
    $this->assertNotEmpty($this->assertSession()
        ->waitForElementRemoved('css', 'ul.ckeditor5-toolbar-available__buttons'));
    $this->assertEmpty($this->assertSession()
        ->waitForField('editor[settings][ponies_too]'));
    $page->selectFieldOption('editor[editor]', 'unicorn');
    $this->assertNotEmpty($this->assertSession()
        ->waitForField('editor[settings][ponies_too]'));
}

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