You are here

public function EditorAdminTest::testAddEditorToExistingFormat in Drupal 8

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

Tests adding a text editor to an existing text format.

File

core/modules/editor/tests/src/Functional/EditorAdminTest.php, line 81

Class

EditorAdminTest
Tests administration of text editors.

Namespace

Drupal\Tests\editor\Functional

Code

public function testAddEditorToExistingFormat() {
  $this
    ->enableUnicornEditor();
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/content/formats/manage/filtered_html');
  $edit = $this
    ->selectUnicornEditor();

  // Configure Unicorn Editor's setting to another value.
  $edit['editor[settings][ponies_too]'] = FALSE;
  $this
    ->drupalPostForm(NULL, $edit, t('Save configuration'));
  $this
    ->verifyUnicornEditorConfiguration('filtered_html', FALSE);

  // Switch back to 'None' and check the Unicorn Editor's settings are gone.
  $edit = [
    'editor[editor]' => '',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Configure');
  $unicorn_setting = $this
    ->xpath('//input[@name="editor[settings][ponies_too]" and @type="checkbox" and @checked]');
  $this
    ->assertCount(0, $unicorn_setting, "Unicorn Editor's settings form is no longer present.");
}