function EditorAdminTest::testEditorSelection

Same name and namespace in other branches
  1. 9 core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php \Drupal\Tests\editor\FunctionalJavascript\EditorAdminTest::testEditorSelection()
  2. 8.9.x core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php \Drupal\Tests\editor\FunctionalJavascript\EditorAdminTest::testEditorSelection()
  3. 11.x core/modules/editor/tests/src/FunctionalJavascript/EditorAdminTest.php \Drupal\Tests\editor\FunctionalJavascript\EditorAdminTest::testEditorSelection()

Tests that editor selection can be toggled without breaking ajax.

File

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

Class

EditorAdminTest
@group editor

Namespace

Drupal\Tests\editor\FunctionalJavascript

Code

public function testEditorSelection() : void {
  $page = $this->getSession()
    ->getPage();
  $assert_session = $this->assertSession();
  $this->drupalGet('/admin/config/content/formats/add');
  $page->fillField('name', 'Sulaco');
  // Wait for machine name to be filled in.
  $this->assertNotEmpty($assert_session->waitForText('sulaco'));
  $page->selectFieldOption('editor[editor]', 'unicorn');
  $this->assertNotEmpty($this->assertSession()
    ->waitForField('editor[settings][ponies_too]'));
  $page->pressButton('Save configuration');
  // Test that toggling the editor selection off and back on works.
  $this->drupalGet('/admin/config/content/formats/manage/sulaco');
  // Deselect and reselect an editor.
  $page->selectFieldOption('editor[editor]', '');
  $this->assertNotEmpty($this->assertSession()
    ->waitForElementRemoved('named', [
    'field',
    '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.