public function YamlFormElementStatesTest::testSelectors in YAML Form 8
Tests element #states selectors.
File
- src/
Tests/ YamlFormElementStatesTest.php, line 28
Class
- YamlFormElementStatesTest
- Tests for form element #states.
Namespace
Drupal\yamlform\TestsCode
public function testSelectors() {
/** @var \Drupal\yamlform\YamlFormInterface $yamlform */
$yamlform = YamlForm::load('example_elements');
$yamlform
->setStatus(TRUE)
->save();
$this
->drupalGet('yamlform/example_elements');
$selectors = OptGroup::flattenOptions($yamlform
->getElementsSelectorOptions());
// Ignore text format and captcha selectors which are not available during
// this test.
unset($selectors[':input[name="text_format[format]"]'], $selectors[':input[name="captcha"]']);
foreach ($selectors as $selector => $name) {
// Remove :input since it is a jQuery specific selector.
$selector = str_replace(':input', '', $selector);
$this
->assertCssSelect($selector);
}
}