OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Implicit Form Submission</title> | 3 <title>Implicit Form Submission</title> |
4 <script> | 4 <script> |
5 | 5 |
6 var currentTest = 0; | 6 var currentTest = 0; |
7 | 7 |
8 // match IE and FF unless specified otherwise. | 8 // match IE and FF unless specified otherwise. |
9 var allTests = [ | 9 var allTests = [ |
10 [ "Single text input", "!text", "y" ], | 10 [ "Single text input", "!text", "y" ], |
(...skipping 15 matching lines...) Expand all Loading... |
26 [ "Single checkbox with a submit", "!checkbox,submit", "y" ], | 26 [ "Single checkbox with a submit", "!checkbox,submit", "y" ], |
27 [ "Single checkbox with a submit disabled", "!checkbox,-submit", "n" ], | 27 [ "Single checkbox with a submit disabled", "!checkbox,-submit", "n" ], |
28 [ "Single select", "!select", "n" ], | 28 [ "Single select", "!select", "n" ], |
29 [ "Select with a submit", "!select,submit", "y" ], // match neither FF nor I
E, instead follow logic. | 29 [ "Select with a submit", "!select,submit", "y" ], // match neither FF nor I
E, instead follow logic. |
30 [ "Select with a disabled submit", "!select,-submit", "n" ], | 30 [ "Select with a disabled submit", "!select,-submit", "n" ], |
31 [ "Multi-line select with a submit", "!selectBox,submit", "y" ], // match ne
ither FF nor IE, instead follow logic. | 31 [ "Multi-line select with a submit", "!selectBox,submit", "y" ], // match ne
ither FF nor IE, instead follow logic. |
32 [ "Multi-line select with a disabled submit", "!selectBox,-submit", "n" ], | 32 [ "Multi-line select with a disabled submit", "!selectBox,-submit", "n" ], |
33 [ "Text field and single select, text focused", "!text,select", "y" ], | 33 [ "Text field and single select, text focused", "!text,select", "y" ], |
34 [ "Text field and single select, select focused", "text,!select", "n" ], | 34 [ "Text field and single select, select focused", "text,!select", "n" ], |
35 [ "Multiple text inputs with a button", "!text,text,button", "y"], | 35 [ "Multiple text inputs with a button", "!text,text,button", "y"], |
36 [ "Multiple text inputs with a disabled button", "!text,text,-button", "n"] | 36 [ "Multiple text inputs with a disabled button", "!text,text,-button", "n"], |
| 37 [ "Multiple text inputs with a hidden submit", "!text,text,?submit", "y"] |
37 ]; | 38 ]; |
38 | 39 |
39 if (window.testRunner) { | 40 if (window.testRunner) { |
40 testRunner.dumpAsText(); | 41 testRunner.dumpAsText(); |
41 testRunner.waitUntilDone(); | 42 testRunner.waitUntilDone(); |
42 } | 43 } |
43 | 44 |
44 var results = { | 45 var results = { |
45 submissionReported: false, | 46 submissionReported: false, |
46 data: [], | 47 data: [], |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 }) | 89 }) |
89 if (!window.eventSender) | 90 if (!window.eventSender) |
90 form.appendChild(document.createElement("p")).innerHTML = "Press Enter k
ey"; | 91 form.appendChild(document.createElement("p")).innerHTML = "Press Enter k
ey"; |
91 inputs.forEach(function(type, i) | 92 inputs.forEach(function(type, i) |
92 { | 93 { |
93 var focused; | 94 var focused; |
94 if (type[0] == '!') { | 95 if (type[0] == '!') { |
95 type = type.substr(1); | 96 type = type.substr(1); |
96 focused = true; | 97 focused = true; |
97 } | 98 } |
| 99 var hidden; |
| 100 if (type[0] == '?') { |
| 101 type = type.substr(1); |
| 102 hidden = true; |
| 103 } |
98 var disabled; | 104 var disabled; |
99 if (type[0] == '-') { | 105 if (type[0] == '-') { |
100 type = type.substr(1); | 106 type = type.substr(1); |
101 disabled = true; | 107 disabled = true; |
102 } | 108 } |
103 var control; | 109 var control; |
104 if (type == "textarea") { | 110 if (type == "textarea") { |
105 control = document.createElement(type); | 111 control = document.createElement(type); |
106 } else if (type == "select") { | 112 } else if (type == "select") { |
107 control = document.createElement(type); | 113 control = document.createElement(type); |
108 control.options.add(new Option("a")); | 114 control.options.add(new Option("a")); |
109 } else if (type == "selectBox") { | 115 } else if (type == "selectBox") { |
110 control = document.createElement("select"); | 116 control = document.createElement("select"); |
111 control.size = 5; | 117 control.size = 5; |
112 control.options.add(new Option("a")); | 118 control.options.add(new Option("a")); |
113 } else if (type == "button") { | 119 } else if (type == "button") { |
114 control = document.createElement(type); | 120 control = document.createElement(type); |
115 control.type = "submit"; | 121 control.type = "submit"; |
116 } else { | 122 } else { |
117 control = document.createElement("input"); | 123 control = document.createElement("input"); |
118 control.type = type; | 124 control.type = type; |
119 } | 125 } |
120 control.id = focused ? "focused" : ("input" + i); | 126 control.id = focused ? "focused" : ("input" + i); |
121 control.disabled = !!disabled; | 127 control.disabled = !!disabled; |
| 128 if (hidden) |
| 129 control.style.display = 'none'; |
122 form.appendChild(control); | 130 form.appendChild(control); |
123 }); | 131 }); |
124 var input = document.getElementById("focused"); | 132 var input = document.getElementById("focused"); |
125 if (input) | 133 if (input) |
126 input.focus(); | 134 input.focus(); |
127 if (window.eventSender) { | 135 if (window.eventSender) { |
128 eventSender.keyDown("\r", []); | 136 eventSender.keyDown("\r", []); |
129 results.testCompleted(); | 137 results.testCompleted(); |
130 } else { | 138 } else { |
131 var a = document.createElement("a"); | 139 var a = document.createElement("a"); |
(...skipping 10 matching lines...) Expand all Loading... |
142 } | 150 } |
143 | 151 |
144 </script> | 152 </script> |
145 </head> | 153 </head> |
146 <body onload="runTest()"> | 154 <body onload="runTest()"> |
147 <p>Tests various combinations of form elements and how implicit submission w
orks with them. | 155 <p>Tests various combinations of form elements and how implicit submission w
orks with them. |
148 <div id="arena"></div> | 156 <div id="arena"></div> |
149 <div id="log"></div> | 157 <div id="log"></div> |
150 </body> | 158 </body> |
151 </html> | 159 </html> |
OLD | NEW |