1 ajax.test | AJAXElementValidation::testAJAXElementValidation() |
Try to post an Ajax change to a form that has a validated element.
The driver_text field is Ajax-enabled. An additional field is not, but is set to be a required field. In this test the required field is not filled in, and we want to see if the activation of the "driver_text" Ajax-enabled field fails due to the required field being empty.
File
- core/
modules/ simpletest/ tests/ ajax.test, line 564 - Ajax Tests.
Class
- AJAXElementValidation
- Miscellaneous Ajax tests using ajax_test module.
Code
function testAJAXElementValidation() {
$web_user = $this->backdropCreateUser();
$edit = array('driver_text' => t('some dumb text'));
// Post with 'driver_text' as the triggering element.
$post_result = $this->backdropPostAJAX('ajax_validation_test', $edit, 'driver_text');
// Look for a validation failure in the resultant JSON.
$this->assertNoText(t('Error message'), "No error message in resultant JSON");
$this->assertText('ajax_forms_test_validation_form_callback invoked', 'The correct callback was invoked');
}