function FilterHtmlTest::testTableTags

Same name in other branches
  1. 9 core/modules/filter/tests/src/FunctionalJavascript/FilterHtmlTest.php \Drupal\Tests\filter\FunctionalJavascript\FilterHtmlTest::testTableTags()
  2. 10 core/modules/filter/tests/src/FunctionalJavascript/FilterHtmlTest.php \Drupal\Tests\filter\FunctionalJavascript\FilterHtmlTest::testTableTags()

Tests restricting HTML to table tags.

File

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

Class

FilterHtmlTest
Tests the 'filter_html' plugin javascript functionality.

Namespace

Drupal\Tests\filter\FunctionalJavascript

Code

public function testTableTags() {
    FilterFormat::create([
        'format' => 'some_html',
        'name' => 'Some HTML',
        'filters' => [
            'filter_html' => [
                'status' => 1,
                'settings' => [
                    'allowed_html' => '<caption> <tbody> <thead> <tfoot> <th> <td> <tr>',
                ],
            ],
        ],
    ])->save();
    $this->drupalLogin($this->drupalCreateUser([
        'administer filters',
    ]));
    $this->drupalGet('admin/config/content/formats/manage/some_html');
    $js_condition = "Drupal.behaviors.filterFilterHtmlUpdating._parseSetting(\n      jQuery('#edit-filters-filter-html-settings-allowed-html').val()\n    )['td'].tags.length >= 0";
    $this->assertJsCondition($js_condition);
}

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