blob: 308c93786bce22018885a98b09696f0c1a0d724f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<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>
<input type=submit id=s>
</form>
<script>
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.');
} else {
// 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")');
debug('TEST COMPLETE');
}
if (window.testRunner)
testRunner.notifyDone();
}
if (window.testRunner)
testRunner.waitUntilDone();
window.onload = startOrVerify;
</script>
</body>
</html>
|