| <script src="../../resources/js-test-pre.js"></script> |
| <form id=f action="interactive-validation-prevented.html"> |
| <input type=hidden name=submitted value=true> |
| <input name=i0 required id=i0 value="abc"> |
| <input name=i1 required id=i1 style="display:none"> |
| <input name=i2 required id=i2> |
| description('Test if an invalid control prevents interactive form submission, and the first invalid focusable control gets focus.'); |
| function startOrVerify() { |
| var query = window.location.search; |
| if (query.indexOf('submitted=true') != -1) { |
| testFailed('The form should not be submitted.'); |
| // Force to render the form. |
| document.getElementById("f").offsetWidth; |
| // HTMLFormElement::submit() skips validation. Use the submit button. |
| document.getElementById('s').click(); |
| testPassed('The form was not submitted'); |
| shouldBe('document.activeElement', 'document.getElementById("i2")'); |
| testRunner.waitUntilDone(); |
| window.onload = startOrVerify; |