class StateDemoTest
Same name in other branches
- 3.x modules/form_api_example/tests/src/FunctionalJavascript/StateDemoTest.php \Drupal\Tests\form_api_example\FunctionalJavascript\StateDemoTest
- 4.0.x modules/form_api_example/tests/src/FunctionalJavascript/StateDemoTest.php \Drupal\Tests\form_api_example\FunctionalJavascript\StateDemoTest
@group form_api_example
Hierarchy
- class \Drupal\Tests\form_api_example\FunctionalJavascript\StateDemoTest extends \Drupal\FunctionalJavascriptTests\WebDriverTestBase
Expanded class hierarchy of StateDemoTest
Related topics
File
-
form_api_example/
tests/ src/ FunctionalJavascript/ StateDemoTest.php, line 13
Namespace
Drupal\Tests\form_api_example\FunctionalJavascriptView source
class StateDemoTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Our module dependencies.
*
* @var string[]
*/
public static $modules = [
'form_api_example',
];
/**
* Functional tests for the StateDemo example form.
*/
public function testStateForm() {
// Visit form route.
$route = Url::fromRoute('form_api_example.state_demo');
$this->drupalGet($route);
// Get Mink stuff.
$page = $this->getSession()
->getPage();
// Verify we can find the diet restrictions textfield, and that by default
// it is not visible.
$this->assertNotEmpty($checkbox = $page->find('css', 'input[name="diet"]'));
$this->assertFalse($checkbox->isVisible(), 'Diet restrictions field is not visible.');
// Check the needs special accommodation checkbox.
$page->checkField('needs_accommodation');
// Verify the textfield is visible now.
$this->assertTrue($checkbox->isVisible(), 'Diet restrictions field is visible.');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
StateDemoTest::$defaultTheme | protected | property | |
StateDemoTest::$modules | public static | property | Our module dependencies. |
StateDemoTest::testStateForm | public | function | Functional tests for the StateDemo example form. |