| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../../resources/js-test.js"></script> |
| <script src="form-validation.js"></script> |
| <form> |
| Required text input: <input type="text" id="required_text_input" required><input id="required_text_input_submit" type="submit"> |
| </form> |
| <div id="description"></div> |
| <div id="console"></div> |
| <script> |
| description("Tests that the HTML form validation bubble gets dismissed when pressing the Escape key."); |
| jsTestIsAsync = true; |
| |
| onload = function() { |
| input = document.getElementById("required_text_input"); |
| submit = document.getElementById("required_text_input_submit"); |
| submit.click(); |
| |
| getValidationMessage().then((_message) => { |
| if (_message !== "Fill out this field") |
| testFailed("Unexpected validation message: " + _message); |
| |
| // Press Escape key. |
| eventSender.keyDown("escape"); |
| |
| getValidationMessage().then((_message) => { |
| message = _message; |
| shouldBeEqualToString("message", ""); // No longer visible. |
| finishJSTest(); |
| }); |
| }); |
| } |
| </script> |
| </body> |
| <html> |