You are here

public function UiDialogTest::testDefaultClass in Editor Advanced Image 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/UiDialogTest.php \Drupal\Tests\editor_advanced_image\FunctionalJavascript\UiDialogTest::testDefaultClass()

Test Default Class is shown when configured.

File

tests/src/FunctionalJavascript/UiDialogTest.php, line 250

Class

UiDialogTest
Tests event info pages and links.

Namespace

Drupal\Tests\editor_advanced_image\FunctionalJavascript

Code

public function testDefaultClass() {

  // Disable the filter_html filter: allow *all *tags.
  $this->editorFilterFormat
    ->setFilterConfig('filter_html', [
    'status' => 0,
  ]);
  $this->editorFilterFormat
    ->save();

  // Add a default class in the settings.
  $settings = [
    'toolbar' => [
      'rows' => [
        [
          [
            'name' => 'Image',
            'items' => [
              'DrupalImage',
            ],
          ],
        ],
      ],
    ],
    'plugins' => [
      'editoradvancedimage' => [
        'default_class' => 'test-default-class',
      ],
    ],
  ];
  $this->editor
    ->setSettings($settings);
  $this->editor
    ->save();
  $this
    ->testImageBaseDialogWorks();
  $this
    ->assertElementPresent('.ui-dialog .form-item-attributes-class');
  $this
    ->assertSession()
    ->elementContains('css', '.ui-dialog .form-item-attributes-class', 'Default: <code>test-default-class</code>');
}