function AjaxFormPageCacheTest::testAjaxElementValidation
Same name in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxFormPageCacheTest::testAjaxElementValidation()
- 8.9.x core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxFormPageCacheTest::testAjaxElementValidation()
- 11.x core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxFormPageCacheTest::testAjaxElementValidation()
Tests that updating the text field trigger an AJAX request/response.
See also
\Drupal\system\Tests\Ajax\ElementValidationTest::testAjaxElementValidation()
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ AjaxFormPageCacheTest.php, line 119
Class
- AjaxFormPageCacheTest
- Performs tests on AJAX forms in cached pages.
Namespace
Drupal\FunctionalJavascriptTests\AjaxCode
public function testAjaxElementValidation() : void {
$this->drupalGet('ajax_validation_test');
// Changing the value of the textfield will trigger an AJAX
// request/response.
$field = $this->getSession()
->getPage()
->findField('driver_text');
$field->setValue('some dumb text');
$field->blur();
// When the AJAX command updates the DOM a <ul> unsorted list
// "message__list" structure will appear on the page echoing back the
// "some dumb text" message.
$placeholder = $this->assertSession()
->waitForElement('css', "[aria-label='Status message'] > ul > li > em:contains('some dumb text')");
$this->assertNotNull($placeholder, 'Message structure containing input data located.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.