Index: LayoutTests/fast/forms/file/file-input-reset-validation.html |
diff --git a/LayoutTests/fast/forms/file/file-input-reset-validation.html b/LayoutTests/fast/forms/file/file-input-reset-validation.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..baf1667afc281081094327f8d7c90235a6731f25 |
--- /dev/null |
+++ b/LayoutTests/fast/forms/file/file-input-reset-validation.html |
@@ -0,0 +1,43 @@ |
+<!DOCTYPE html> |
+<form method="GET" onsubmit="fail()"> |
+<input type="file" oninvalid="pass()" required> |
+<input type="reset"> |
+<input type="submit"> |
+</form> |
+<pre id="console"></pre> |
+<script> |
+function log(message) |
tkent
2014/01/28 11:05:46
nit: I recommend to use js-test.js.
sof
2014/01/28 11:38:51
Thanks, good idea. Switched over now.
(There's an
|
+{ |
+ document.getElementById('console').appendChild(document.createTextNode(message + "\n")); |
+} |
+ |
+function pass() |
+{ |
+ log("PASS: Reset file input failed to validate on submit"); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+} |
+ |
+function fail() |
+{ |
+ log("FAIL: Form validated ok and and was submitted."); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+ return false; |
+} |
+ |
+function startTest() |
+{ |
+ eventSender.beginDragWithFiles(['file-input-reset-validation.html']); |
+ eventSender.mouseMoveTo(10, 10); |
+ eventSender.mouseUp(); |
+ document.forms[0].querySelector("[type=reset]").click(); |
+ document.forms[0].querySelector("[type=submit]").click(); |
+} |
+ |
+if (window.eventSender) { |
+ testRunner.dumpAsText(); |
+ testRunner.waitUntilDone(); |
+ window.onload = startTest; |
+} |
+</script> |