Index: LayoutTests/fast/forms/submit-onFocus-invalidForm.html |
diff --git a/LayoutTests/fast/forms/submit-onFocus-invalidForm.html b/LayoutTests/fast/forms/submit-onFocus-invalidForm.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..27404012ab3dfbdd19cfcb39bebbfcbcd8a792c4 |
--- /dev/null |
+++ b/LayoutTests/fast/forms/submit-onFocus-invalidForm.html |
@@ -0,0 +1,44 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<form method="GET" target="target" id="form"> |
+ <input name="query" value="AAA" pattern="banana|cherry" onfocus="onFocus(event)"/> |
+ <input type="submit" id="submitButton"/> |
+</form> |
+<iframe id="target" name="target"></iframe> |
+<script> |
+description('Test that form.submit() when called on "focus" event for invalid form should submit the form'); |
+var count = 1; |
+ |
+function asyncTest(query) { |
tkent
2014/04/01 02:23:15
This function and 'count' are unnecessary. We can
harpreet.sk
2014/04/01 05:46:07
Done.
|
+ if (query === '?query=AAA') { |
+ if (--count == 0) { |
+ testPassed('Form is successfully submitted and content is loaded in the frame'); |
+ finishJSTest(); |
+ } |
+ } |
+} |
+ |
+function onFocus(event) { |
+ var form = document.getElementById('form'); |
+ form.action = '#foo'; |
+ form.submit(); |
+} |
+ |
+document.getElementById('target').onload = function(event) { |
+ // This should return back query AAA |
+ asyncTest(event.target.contentWindow.location.search); |
+} |
+ |
+window.onload = function() { |
+ document.getElementById('submitButton').click(); |
+} |
+ |
+if (window.testRunner) |
+ window.jsTestIsAsync = true; |
+</script> |
+</body> |
+</html> |