You are here

public function YamlFormElementTest::testElements in YAML Form 8

Test element settings.

File

src/Tests/YamlFormElementTest.php, line 24

Class

YamlFormElementTest
Tests for form elements.

Namespace

Drupal\yamlform\Tests

Code

public function testElements() {

  /**************************************************************************/

  // Allowed tags

  /**************************************************************************/

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

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

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