You are here

protected function EditorAdminTest::selectUnicornEditor in Drupal 10

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

Tests and selects the unicorn editor.

Return value

array Returns an edit array containing the values to be posted.

File

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

Class

EditorAdminTest
Tests administration of text editors.

Namespace

Drupal\Tests\editor\Functional

Code

protected function selectUnicornEditor() {

  // Verify the <select> when a text editor is available.
  $select = $this
    ->assertSession()
    ->selectExists('editor[editor]');
  $this
    ->assertFalse($select
    ->hasAttribute('disabled'));
  $options = $select
    ->findAll('css', 'option');
  $this
    ->assertCount(2, $options);
  $this
    ->assertSame('None', $options[0]
    ->getText(), 'Option 1 in the Text Editor select is "None".');
  $this
    ->assertSame('Unicorn Editor', $options[1]
    ->getText(), 'Option 2 in the Text Editor select is "Unicorn Editor".');
  $this
    ->assertTrue($options[0]
    ->hasAttribute('selected'), 'Option 1 ("None") is selected.');

  // Ensure the none option is selected.
  $this
    ->assertSession()
    ->pageTextNotContains('This option is disabled because no modules that provide a text editor are currently enabled.');

  // Select the "Unicorn Editor" editor and click the "Configure" button.
  $edit = [
    'editor[editor]' => 'unicorn',
  ];
  $this
    ->submitForm($edit, 'Configure');
  $this
    ->assertSession()
    ->checkboxChecked('editor[settings][ponies_too]');
  return $edit;
}