You are here

public function WebformStatesManagerTest::testStatesToText in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/States/WebformStatesManagerTest.php \Drupal\Tests\webform\Functional\States\WebformStatesManagerTest::testStatesToText()

Tests states to text.

File

tests/src/Functional/States/WebformStatesManagerTest.php, line 31

Class

WebformStatesManagerTest
Tests for webform states manager.

Namespace

Drupal\Tests\webform\Functional\States

Code

public function testStatesToText() {

  // Check converting #states to human readable text.
  $this
    ->drupalGet('/webform/test_states_to_text/confirmation');
  $this
    ->assertRaw('<label>textfield_and</label>');
  $this
    ->assertRaw('This element is <strong>required</strong> when <strong>all</strong> of the following conditions are met:<ul><li><strong>some_trigger</strong> is checked.</li><li><strong>some_value</strong> = <strong>one</strong>.</li><li><strong>some_number</strong> &gt;= <strong>1</strong>.</li></ul>');
  $this
    ->assertRaw('<label>textfield_or</label>');
  $this
    ->assertRaw('This element is <strong>required</strong> when <strong>any</strong> of the following conditions are met:<ul><li><strong>some_trigger</strong> is checked.</li><li><strong>some_value</strong> = <strong>one</strong>.</li><li><strong>some_number</strong> &gt;= <strong>1</strong>.</li></ul>');
  $this
    ->assertRaw('<label>textfield_or</label>');
  $this
    ->assertRaw('This element is <strong>required</strong> when <strong>any</strong> of the following conditions are met:<ul><li><strong>some_trigger</strong> is not checked.</li><li>When <strong>any</strong> of the following (nested) conditions are met:<ul><li><strong>some_value</strong> = <strong>one</strong>.</li><li><strong>some_number</strong> is between <strong>1</strong> and <strong>10</strong>.</li></ul></li></ul>');
}