You are here

public function WebformElementAllowsTagsTest::testAllowsTags in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/Element/WebformElementAllowsTagsTest.php \Drupal\Tests\webform\Functional\Element\WebformElementAllowsTagsTest::testAllowsTags()

Test element allowed tags.

File

tests/src/Functional/Element/WebformElementAllowsTagsTest.php, line 22

Class

WebformElementAllowsTagsTest
Tests for element allowed tags.

Namespace

Drupal\Tests\webform\Functional\Element

Code

public function testAllowsTags() {

  // Check <b> tags is allowed.
  $this
    ->drupalGet('/webform/test_element_allowed_tags');
  $this
    ->assertRaw('Hello <b>…Goodbye</b>');

  // Check custom <ignored> <tag> is allowed and <b> tag removed.
  \Drupal::configFactory()
    ->getEditable('webform.settings')
    ->set('element.allowed_tags', 'ignored tag')
    ->save();
  $this
    ->drupalGet('/webform/test_element_allowed_tags');
  $this
    ->assertRaw('Hello <ignored></tag>…Goodbye');

  // Restore admin tags.
  \Drupal::configFactory()
    ->getEditable('webform.settings')
    ->set('element.allowed_tags', 'admin')
    ->save();
}