Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/ValidityState-valueMissing.html

Issue 2211743003: Merge layout tests ValidityState-valueMissing-00N.html into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/forms/ValidityState-valueMissing-001.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <body>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5
6 <input id="input-empty" name="victim" required/>
7 <input id="input-nonempty" name="victim" value="something" required/>
8 <textarea id="textarea-empty" name="victim" required></textarea>
9 <textarea id="textarea-nonempty" name="victim" required>something</textarea>
10 <select id="select-no-option" name="victim" required>
11 </select>
12 <select id="select-placeholder-selected" name="victim" required>
13 <option value="" selected />
14 <option value="X">X</option>
15 </select>
16 <select id="select-without-placeholder" name="victim" required>
17 <option value="X">X</option>
18 <option value="" selected />
19 </select>
20 <select id="select-placeholder-selected-size2" name="victim" size="2" required>
21 <option value="" selected />
22 <option value="X">X</option>
23 </select>
24 <select id="select-without-placeholder-size2" name="victim" size="2" required>
25 <option value="X">X</option>
26 <option value="" selected />
27 </select>
28 <select id="select-none-selected-multiple" name="victim" multiple required>
29 <option value="" />
30 <option value="X">X</option>
31 </select>
32 <select id="select-fake-placeholder-selected-multiple" name="victim" multiple re quired>
33 <option value="" selected />
34 <option value="X">X</option>
35 </select>
36 <select id="select-without-fake-placeholder-multiple" name="victim" multiple req uired>
37 <option value="X">X</option>
38 <option value="" selected />
39 </select>
40 <select id="select-none-selected-size2-multiple" name="victim" multiple size="2" required>
41 <option value="" />
42 <option value="X">X</option>
43 </select>
44 <select id="select-fake-placeholder-selected-size2-multiple" name="victim" multi ple size="2" required>
45 <option value="" selected />
46 <option value="X">X</option>
47 </select>
48 <select id="select-without-fake-placeholder-size2-multiple" name="victim" multip le size="2" required>
49 <option value="X">X</option>
50 <option value="" selected />
51 </select>
52 <select id="select-optgroup" name="victim" required>
53 <optgroup label="1">
54 <option value="" selected />
55 </optgroup>
56 <option value="X">X</option>
57 </select>
58 <select id="select-disabled-option" name="victim" required>
59 <option value="" disabled selected />
60 <option value="X">X</option>
61 </select>
62 <select id="select-disabled-option-2" name="victim" required>
63 <option value="" disabled />
64 <option value="X">X</option>
65 </select>
66
67 <select id="select-with-placeholder" name="victim" required>
68 <option value="" />
69 <option value="X" selected>X</option>
70 </select>
71 <select id="select-with-fake-placeholder-size2" name="victim" size="2" required>
72 <option value="" />
73 <option value="X" selected>X</option>
74 </select>
75 <select id="select-without-fake-placeholder-size2" name="victim" size="2" requir ed>
76 <option value="X" selected>X</option>
77 <option value="" />
78 </select>
79 <select id="select-with-fake-placeholder-multiple" name="victim" multiple requir ed>
80 <option value="" />
81 <option value="X" selected>X</option>
82 </select>
83 <select id="select-without-fake-placeholder-multiple" name="victim" multiple req uired>
84 <option value="X" selected>X</option>
85 <option value="" />
86 </select>
87 <select id="select-with-fake-placeholder-size2-multiple" name="victim" multiple size="2" required>
88 <option value="" />
89 <option value="X" selected>X</option>
90 </select>
91 <select id="select-without-fake-placeholder-size2-multiple" name="victim" multip le size="2" required>
92 <option value="X" selected>X</option>
93 <option value="" />
94 </select>
95 <select id="select-selecting-by-key" required>
96 <option value="" selected/>
97 <option>a</option>
98 </select>
99 <select id="select-selecting-by-key-2" required>
100 <option value="" selected/>
101 <option accesskey="1">a</option>
102 </select>
103
104 <input name="victim" disabled required />
105 <textarea name="victim" disabled required></textarea>
106 <select name="victim" disabled required>
107 </select>
108 <select name="victim" disabled required>
109 <option value="" selected />
110 <option value="X">X</option>
111 </select>
112 <select name="victim" disabled required>
113 <option value="X">X</option>
114 <option value="" selected />
115 </select>
116 <select name="victim" size="2" disabled required>
117 <option value="" selected />
118 <option value="X">X</option>
119 </select>
120 <select name="victim" size="2" disabled required>
121 <option value="X">X</option>
122 <option value="" selected />
123 </select>
124 <select name="victim" multiple disabled required>
125 <option value="" />
126 <option value="X">X</option>
127 </select>
128 <select name="victim" multiple disabled required>
129 <option value="" selected />
130 <option value="X">X</option>
131 </select>
132 <select name="victim" multiple disabled required>
133 <option value="X">X</option>
134 <option value="" selected />
135 </select>
136 <select name="victim" multiple size="2" disabled required>
137 <option value="" />
138 <option value="X">X</option>
139 </select>
140 <select name="victim" multiple size="2" disabled required>
141 <option value="" selected />
142 <option value="X">X</option>
143 </select>
144 <select name="victim" multiple size="2" disabled required>
145 <option value="X">X</option>
146 <option value="" selected />
147 </select>
148
149 <input name="victim" readonly required />
150 <textarea name="victim" readonly required></textarea>
151
152 <fieldset id="non-supported-container">
153 <input name="victim" type="hidden" required />
154 <input name="victim" type="range" required />
155 <input name="victim" type="image" required />
156 <input name="victim" type="reset" required />
157 <input name="victim" type="button" required />
158 <input name="victim" type="submit" required />
159 </fieldset>
160
161 <input name="victim" type="checkbox" required checked />
162 <input name="victim" type="checkbox" required />
163
164 <input id="input-file" type="file" required />
165 <input id="input-text" type="text" required />
166 <input id="input-search" type="search" required />
167 <input id="input-url" type="url" required />
168 <input id="input-tel" type="tel" required />
169 <input id="input-email" type="email" required />
170 <input id="input-password" type="password" required />
171 <input id="input-number" type="number" required />
172
173 <script>
174 function valueMissingFor(id) {
175 return document.getElementById(id).validity.valueMissing;
176 }
177
178 test(() => {
179 assert_true(valueMissingFor('input-empty'));
yosin_UTC9 2016/08/04 08:19:19 Since sample and verification is too far away, it
tkent 2016/08/04 23:08:26 That's a good idea. Done in Patch Set 2.
180 }, 'Empty-value INPUT[required] should be valueMissing.');
181
182 test(() => {
183 assert_false(valueMissingFor('input-nonempty'));
184 }, 'INPUT[required] with a non-empty value should not be valueMissing.');
185
186 test(() => {
187 assert_true(valueMissingFor('textarea-empty'));
188 }, 'Empty value TEXTAREA[required] should be valueMissing.');
189
190 test(() => {
191 assert_false(valueMissingFor('textarea-nonempty'));
192 }, 'TEXTAREA[required] with a non-empty value should not be valueMissing.');
193
194 test(() => {
195 assert_true(valueMissingFor('select-no-option'));
196 }, 'SELECT[required] with no OPTIONS should be valueMissing.');
197
198 test(() => {
199 assert_true(valueMissingFor('select-placeholder-selected'));
200 }, 'SELECT[required] with a selected placeholder OPTION should be valueMissing.' );
201
202 test(() => {
203 assert_false(valueMissingFor('select-without-placeholder'));
204 }, 'SELECT[required] with a selected non-placeholder OPTION should not be valueM issing.');
205
206 test(() => {
207 assert_false(valueMissingFor('select-placeholder-selected-size2'));
208 }, 'SELECT[required][size=2] with a selected placeholder OPTION should not be va lueMissing.');
209
210 test(() => {
211 assert_false(valueMissingFor('select-without-placeholder-size2'));
212 }, 'SELECT[rquired][size=2] with a selected non-placeholder OPTION should not be valueMissing.');
213
214 test(() => {
215 assert_true(valueMissingFor('select-none-selected-multiple'));
216 }, 'SELECT[required][multiple] without selected OPTIONs should be valueMissing.' );
217
218 test(() => {
219 assert_false(valueMissingFor('select-fake-placeholder-selected-multiple'));
220 }, 'SELECT[required][multiple] with a selected placeholder-like OPTION should no t be valueMissing.');
221
222 test(() => {
223 assert_false(valueMissingFor('select-without-fake-placeholder-multiple'));
224 }, 'SELECT[required][multiple] with a selected OPTION should not be valueMissing .');
225
226 test(() => {
227 assert_true(valueMissingFor('select-none-selected-size2-multiple'));
228 }, 'SELECT[required][multiple][size=2] without selected OPTIONs should be valueM issing.');
229
230 test(() => {
231 assert_false(valueMissingFor('select-fake-placeholder-selected-size2-multiple' ));
232 }, 'SELECT[required][multiple][size=2] with a selected placeholder-liek OPTION s hould not be valueMissing.');
233
234 test(() => {
235 assert_false(valueMissingFor('select-without-fake-placeholder-size2-multiple') );
236 }, 'SELECT[required][multiple][size=2] with a selected OPTION should not be valu eMissing.');
237
238 test(() => {
239 assert_false(valueMissingFor('select-optgroup'));
240 }, 'SELECT[required] with a selected placeholder-like OPTION inside an OPTGROUP should not be valueMissing.');
241
242 test(() => {
243 assert_true(valueMissingFor('select-disabled-option'));
244 }, 'SELECT[required] with a selected disabled placeholder OPTION should be value Missing.');
245
246 test(() => {
247 assert_false(valueMissingFor('select-disabled-option-2'));
248 assert_equals(document.getElementById('select-disabled-option-2').selectedInde x, 1);
249 }, 'SELECT[required] with a non-selected disabled placeholder OPTION should not be valueMissing.');
250
251 test(() => {
252 assert_false(valueMissingFor('select-with-placeholder'));
253 }, 'SELECT[required] with a unselected placeholder OPTION should not be valueMis sing.');
254
255 test(() => {
256 assert_false(valueMissingFor('select-with-fake-placeholder-size2'));
257 }, 'SELECT[required][size=2] with a unselected placeholder OPTION should not be valueMissing.');
258
259 test(() => {
260 assert_false(valueMissingFor('select-without-fake-placeholder-size2'));
261 }, 'SELECT[required][size=2] with a unselected placeholder-like OPTION should no t be valueMissing.');
262
263 test(() => {
264 assert_false(valueMissingFor('select-with-fake-placeholder-multiple'));
265 }, 'SELECT[required][multiple] with a unselected placeholder OPTION should not b e valueMissing.');
266
267 test(() => {
268 assert_false(valueMissingFor('select-without-fake-placeholder-multiple'));
269 }, 'SELECT[required][multiple] with a unselected placeholder-like OPTION should not be valueMissing.');
270 test(() => {
271 assert_false(valueMissingFor('select-with-fake-placeholder-size2-multiple'));
272 }, 'SELECT[required][size=2][multiple] with a unselected placeholder OPTION shou ld not be valueMissing.');
273 test(() => {
274 assert_false(valueMissingFor('select-without-fake-placeholder-size2-multiple') );
275 }, 'SELECT[required][size=2][multiple] with a unselected placeholder-like OPTION should not be valueMissing.');
276
277 test(() => {
278 assert_true(!!window.eventSender, 'Needs eventSender.');
279 // Select by type-ahead.
280 var select = document.getElementById('select-selecting-by-key');
281 assert_true(valueMissingFor('select-selecting-by-key'));
282 select.focus();
283 eventSender.keyDown('a');
284 assert_equals(select.value, 'a');
285 assert_false(valueMissingFor('select-selecting-by-key'));
286
287 // Select by accesskey.
288 select = document.getElementById('select-selecting-by-key-2');
289 assert_true(valueMissingFor('select-selecting-by-key-2'));
290 select.focus();
291 eventSender.keyDown('1', 'accessKey');
292 assert_equals(select.value, 'a');
293 assert_false(valueMissingFor('select-selecting-by-key-2'));
294 }, 'Updating valueMissing state by user input.');
295
296 test(() => {
297 var controls = document.querySelectorAll(':disabled');
298 for (c in controls) {
299 if (c.validity)
300 assert_false(c.validity.valueMissing);
301 }
302 }, 'Disabled controls never be valueMissing.');
303
304 test(() => {
305 var controls = document.querySelectorAll('[readonly]');
306 for (c in controls) {
307 if (c.validity)
308 assert_false(c.validity.valueMissing);
309 }
310 }, 'Read-only controls never be valueMissing.');
311
312 test(() => {
313 var fieldset = document.querySelector('#non-supported-container');
314 for (c in fieldset.elements) {
315 if (c.validity)
316 assert_false(c.validity.valueMissing);
317 }
318 }, 'INPUT elements of some types never be valueMissing.');
319
320 test(() => {
321 var controls = document.querySelectorAll('input[type=checkbox]');
322 assert_false(controls[0].validity.valueMissing);
323 assert_true(controls[1].validity.valueMissing);
324 }, 'INPUT[type=checkbox] supports valueMissing.');
325
326 test(() => {
327 assert_true(valueMissingFor('input-file'));
328 }, 'INPUT[type=file] supports valueMissing.');
329
330 test(() => {
331 assert_true(valueMissingFor('input-text'));
332 }, 'INPUT[type=text] supports valueMissing.');
333
334 test(() => {
335 assert_true(valueMissingFor('input-search'));
336 }, 'INPUT[type=search] supports valueMissing.');
337
338 test(() => {
339 assert_true(valueMissingFor('input-url'));
340 }, 'INPUT[type=url] supports valueMissing.');
341
342 test(() => {
343 assert_true(valueMissingFor('input-tel'));
344 }, 'INPUT[type=tel] supports valueMissing.');
345
346 test(() => {
347 assert_true(valueMissingFor('input-email'));
348 }, 'INPUT[type=email] supports valueMissing.');
349
350 test(() => {
351 assert_true(valueMissingFor('input-password'));
352 }, 'INPUT[type=password] supports valueMissing.');
353
354 test(() => {
355 assert_true(valueMissingFor('input-number'));
356 }, 'INPUT[type=number] supports valueMissing.');
357 </script>
358 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/forms/ValidityState-valueMissing-001.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698