OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
| 3 <script src="resources/file-drag-common.js"></script> |
3 <form method="GET" onsubmit="finish(false)"> | 4 <form method="GET" onsubmit="finish(false)"> |
4 <input type="file" oninvalid="finish(true)" required> | 5 <input type="file" oninvalid="finish(true)" required> |
5 <input type="reset"> | 6 <input type="reset"> |
6 <input type="submit"> | 7 <input type="submit"> |
7 </form> | 8 </form> |
8 <pre id="console"></pre> | 9 <pre id="console"></pre> |
9 <script> | 10 <script> |
10 description("This tests that a reset file input with a required value doesn't va
lidate."); | 11 description("This tests that a reset file input with a required value doesn't va
lidate."); |
11 | 12 |
12 var invalid = false; | 13 var invalid = false; |
13 function finish(pass) | 14 function finish(pass) |
14 { | 15 { |
15 invalid = pass; | 16 invalid = pass; |
16 shouldBeTrue("invalid"); | 17 shouldBeTrue("invalid"); |
17 finishJSTest(); | 18 finishJSTest(); |
18 } | 19 } |
19 | 20 |
20 function moveMouseToCenterOfElement(element) { | |
21 var centerX = element.offsetLeft + element.offsetWidth / 2; | |
22 var centerY = element.offsetTop + element.offsetHeight / 2; | |
23 eventSender.mouseMoveTo(centerX, centerY); | |
24 } | |
25 | |
26 function dragFilesOntoInput(input, files) { | |
27 eventSender.beginDragWithFiles(files); | |
28 moveMouseToCenterOfElement(input); | |
29 eventSender.mouseUp(); | |
30 } | |
31 | |
32 function startTest() | 21 function startTest() |
33 { | 22 { |
34 dragFilesOntoInput(document.forms[0].querySelector("[type=file]"), ['file-in
put-reset-validation.html']); | 23 dragFilesOntoInput(document.forms[0].querySelector("[type=file]"), ['file-in
put-reset-validation.html']); |
35 document.forms[0].querySelector("[type=reset]").click(); | 24 document.forms[0].querySelector("[type=reset]").click(); |
36 document.forms[0].querySelector("[type=submit]").click(); | 25 document.forms[0].querySelector("[type=submit]").click(); |
37 } | 26 } |
38 | 27 |
39 if (window.eventSender) { | 28 if (window.eventSender) { |
40 window.jsTestIsAsync = true; | 29 window.jsTestIsAsync = true; |
41 testRunner.dumpAsText(); | 30 testRunner.dumpAsText(); |
42 window.onload = startTest; | 31 window.onload = startTest; |
43 } | 32 } |
44 </script> | 33 </script> |
OLD | NEW |