Bug 1587751 [wpt PR 19617] - Move common/form-submission.py to a more specific locati...
[gecko.git] / testing / web-platform / tests / html / semantics / forms / form-submission-0 / submit-entity-body.html
blobf6f3858d4ff025cfbb2ba6b0745df51c6d39436b
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <meta name="timeout" content="long">
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script>
7 var simple_tests = [
9 name: "form submission from form should navigate to url with x-www-form-urlencoded",
10 input: "<input name=foo value=bara>",
11 enctype: "application/x-www-form-urlencoded",
12 submitelement: "",
13 submitaction: function(doc) { doc.getElementById("testform").submit(); }
16 name: "form submission from form should navigate to url with multipart/form-data",
17 input: "<textarea name=foo>bar</textarea>",
18 enctype: "multipart/form-data",
19 submitelement: "",
20 submitaction: function(doc) { doc.getElementById("testform").submit(); }
23 name: "form submission from form should navigate to url with text/plain",
24 input: "<textarea name=qux>baz</textarea>",
25 enctype: "text/plain",
26 submitelement: "",
27 submitaction: function(doc) { doc.getElementById("testform").submit(); }
30 name: "form submission from button should navigate to url with x-www-form-urlencoded",
31 input: "<input name=foo value=bara>",
32 enctype: "application/x-www-form-urlencoded",
33 submitelement: "<button id=buttonsubmit type=\"submit\">Submit</button>",
34 submitaction: function(doc) { doc.getElementById("buttonsubmit").click(); }
37 name: "form submission from button should navigate to url with multipart/form-data",
38 input: "<textarea name=foo>bar</textarea>",
39 enctype: "multipart/form-data",
40 submitelement: "<button id=buttonsubmit type=\"submit\">Submit</button>",
41 submitaction: function(doc) { doc.getElementById("buttonsubmit").click(); }
44 name: "form submission from button should navigate to url with text/plain",
45 input: "<textarea name=qux>baz</textarea>",
46 enctype: "text/plain",
47 submitelement: "<button id=buttonsubmit type=\"submit\">Submit</button>",
48 submitaction: function(doc) { doc.getElementById("buttonsubmit").click(); }
51 name: "form submission from input should navigate to url with x-www-form-urlencoded",
52 input: "<input name=foo value=bara>",
53 enctype: "application/x-www-form-urlencoded",
54 submitelement: "<input id=inputsubmit type=\"submit\">Submit</input>",
55 submitaction: function(doc) { doc.getElementById("inputsubmit").click(); }
58 name: "form submission from input should navigate to url with multipart/form-data",
59 input: "<textarea name=foo>bar</textarea>",
60 enctype: "multipart/form-data",
61 submitelement: "<input id=inputsubmit type=\"submit\">Submit</input>",
62 submitaction: function(doc) { doc.getElementById("inputsubmit").click(); }
65 name: "form submission from input should navigate to url with text/plain",
66 input: "<input name=qux value=baz>",
67 enctype: "text/plain",
68 submitelement: "<input id=inputsubmit type=\"submit\">Submit</input>",
69 submitaction: function(doc) { doc.getElementById("inputsubmit").click(); }
72 name: "form submission from submit input should contain submit button value",
73 input: "<button type=submit name=notclicked value=nope>not clicked</button>",
74 enctype: "application/x-www-form-urlencoded",
75 submitelement: "<button id=inputsubmit type=\"submit\" name=foo value=bara>Submit</button>",
76 submitaction: function(doc) { doc.getElementById("inputsubmit").click(); }
80 name: "form submission from submit button should contain submit button value",
81 input: "<input type=submit name=notclicked value=nope/>",
82 enctype: "application/x-www-form-urlencoded",
83 submitelement: "<input id=inputsubmit type=\"submit\" name=foo value=bara >",
84 submitaction: function(doc) { doc.getElementById("inputsubmit").click(); }
87 simple_tests.forEach(function(test_obj) {
88 test_obj.test = async_test(test_obj.name);
89 });
90 function run_simple_test() {
91 if (simple_tests.length == 0) {
92 return;
94 var test_obj = simple_tests.pop();
95 var t = test_obj.test;
96 var testframe = document.getElementById("testframe");
97 var testdocument = testframe.contentWindow.document;
98 testdocument.body.innerHTML =
99 "<form id=testform method=post action=\"/html/semantics/forms/form-submission-0/resources/form-submission.py\" enctype=\"" + test_obj.enctype + "\">" +
100 test_obj.input +
101 test_obj.submitelement +
102 "</form>";
103 testframe.onload = function() {
104 t.step(function (){
105 var response = testframe.contentDocument.documentElement.textContent;
106 assert_equals(response, "OK");
108 t.done();
109 run_simple_test();
111 test_obj.submitaction(testdocument);
113 </script>
114 <iframe id=testframe src="/common/blank.html" onload="run_simple_test();"></iframe>