function FilterHtmlTest::testStylesToAllowedTagsSync

Tests the Allowed Tags configuration with CSS classes.

@group legacy

File

core/modules/filter/tests/src/FunctionalJavascript/FilterHtmlTest.php, line 58

Class

FilterHtmlTest
Tests the 'filter_html' plugin javascript functionality.

Namespace

Drupal\Tests\filter\FunctionalJavascript

Code

public function testStylesToAllowedTagsSync() {
  \Drupal::service('module_installer')->install([
    'ckeditor',
  ]);
  FilterFormat::create([
    'format' => 'some_html',
    'name' => 'Some HTML',
    'filters' => [
      'filter_html' => [
        'status' => 1,
        'settings' => [
          'allowed_html' => '<span class>',
        ],
      ],
    ],
  ])->save();
  Editor::create([
    'format' => 'some_html',
    'editor' => 'ckeditor',
    'settings' => [
      'plugins' => [
        'stylescombo' => [
          'styles' => 'span.hello-world|Hello World',
        ],
      ],
    ],
  ])->save();
  $this->drupalLogin($this->drupalCreateUser([
    'administer filters',
  ]));
  $this->drupalGet('admin/config/content/formats/manage/some_html');
  $js_condition = "jQuery('#edit-filters-filter-html-settings-allowed-html').val() === \"<span class> <strong> <em> <a href> <ul> <li> <ol> <blockquote> <img src alt data-entity-type data-entity-uuid>\"";
  $this->assertJsCondition($js_condition);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.