You are here

public function TextFormatConfigurationTest::testDialogDefaultValues in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php \Drupal\Tests\video_embed_wysiwyg\Functional\TextFormatConfigurationTest::testDialogDefaultValues()

Test the dialog defaults can be set and work correctly.

File

modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php, line 140

Class

TextFormatConfigurationTest
Test the format configuration form.

Namespace

Drupal\Tests\video_embed_wysiwyg\Functional

Code

public function testDialogDefaultValues() {
  $this
    ->drupalGet($this->formatUrl);

  // Assert all the form fields that appear on the modal, appear as
  // configurable defaults.
  $this
    ->assertSession()
    ->pageTextContains('Autoplay');
  $this
    ->assertSession()
    ->pageTextContains('Responsive Video');
  $this
    ->assertSession()
    ->pageTextContains('Width');
  $this
    ->assertSession()
    ->pageTextContains('Height');
  $this
    ->submitForm([
    'filters[video_embed_wysiwyg][status]' => TRUE,
    'editor[settings][toolbar][button_groups]' => '[[{"name":"Group","items":["video_embed"]}]]',
    'editor[settings][plugins][video_embed][defaults][children][width]' => '123',
    'editor[settings][plugins][video_embed][defaults][children][height]' => '456',
    'editor[settings][plugins][video_embed][defaults][children][responsive]' => FALSE,
    'editor[settings][plugins][video_embed][defaults][children][autoplay]' => FALSE,
  ], t('Save configuration'));

  // Ensure the configured defaults show up on the modal window.
  $this
    ->drupalGet('video-embed-wysiwyg/dialog/plain_text');
  $this
    ->assertSession()
    ->fieldValueEquals('width', '123');
  $this
    ->assertSession()
    ->fieldValueEquals('height', '456');
  $this
    ->assertSession()
    ->fieldValueEquals('autoplay', FALSE);
  $this
    ->assertSession()
    ->fieldValueEquals('responsive', FALSE);
}