public function WebformElementAllowsTagsTest::testAllowsTags in Webform 8.5
Same name and namespace in other branches
- 6.x 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\ElementCode
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();
}