Index: LayoutTests/fast/forms/submit-add-remove-element.html |
diff --git a/LayoutTests/fast/forms/submit-add-remove-element.html b/LayoutTests/fast/forms/submit-add-remove-element.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c54f4a335d592de11618f9e9d25fa602131eb59c |
--- /dev/null |
+++ b/LayoutTests/fast/forms/submit-add-remove-element.html |
@@ -0,0 +1,48 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<form method="GET" id="form" onsubmit="formSubmit();afterSubmit(form);" target="target"> |
+ <input type="text" id="textData" name="textData" value="a"> |
+ <input type="submit" id="submitButton" name="submitform" value="Step"> |
+</form> |
+<iframe id="target" name="target"></iframe> |
+<script> |
+description('Test that form.submit() when submitted from JS, form element added and removed, should submit the form without added element'); |
+ |
+var hidden; |
+function formSubmit(event) |
+{ |
+ var textData = document.getElementById('textData'); |
+ var form = document.getElementById('form'); |
+ var submit = document.getElementById('submitButton'); |
+ textData.value = 'b'; |
+ hidden = document.createElement('hidden'); |
+ hidden.value = submit.value; |
+ hidden.name = submit.name; |
+ form.appendChild(hidden); |
+ form.submit(); |
+ return true; |
+} |
+ |
+function afterSubmit(form) |
+{ |
+ form.removeChild(hidden); |
+} |
+ |
+document.getElementById('target').onload = function(event) { |
+ shouldBeEqualToString('event.target.contentWindow.location.search', '?textData=b&submitform=Step'); |
+ finishJSTest(); |
+} |
tkent
2014/08/08 00:49:33
nit: Need ';' because this is substitution express
|
+ |
+window.onload = function() { |
+ document.getElementById('submitButton').click(); |
+} |
tkent
2014/08/08 00:49:32
Ditto.
|
+ |
+if (window.testRunner) |
+ window.jsTestIsAsync = true; |
+</script> |
+</body> |
+</html> |