public function SettingsTrayBlockFormTest::testValidationMessages in Drupal 8
Same name and namespace in other branches
- 9 core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php \Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::testValidationMessages()
Test that validation errors appear in the off-canvas dialog.
File
- core/
modules/ settings_tray/ tests/ src/ FunctionalJavascript/ SettingsTrayBlockFormTest.php, line 267
Class
- SettingsTrayBlockFormTest
- Testing opening and saving block forms in the off-canvas dialog.
Namespace
Drupal\Tests\settings_tray\FunctionalJavascriptCode
public function testValidationMessages() {
$page = $this
->getSession()
->getPage();
$web_assert = $this
->assertSession();
foreach ($this
->getTestThemes() as $theme) {
$this
->enableTheme($theme);
$block = $this
->placeBlock('settings_tray_test_validation');
$this
->drupalGet('user');
$this
->enableEditMode();
$this
->openBlockForm($this
->getBlockSelector($block));
$page
->pressButton('Save Block with validation error');
$web_assert
->assertWaitOnAjaxRequest();
// The settings_tray_test_validation test plugin form always has a
// validation error.
$web_assert
->elementContains('css', '#drupal-off-canvas', 'Sorry system error. Please save again');
$this
->disableEditMode();
$block
->delete();
}
}