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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/checkValidity.html

Issue 2210743002: Merge layout tests checkValidity-00n.html into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build HTML tree in each of tests 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/checkValidity-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 <div id="sample"></div>
6 <script>
7 // See also imported/wpt/html/semantics/forms/constraints/form-validation-checkV alidity.html.
8
9 function checkValidityFor(html) {
10 var sample = document.getElementById('sample');
11 sample.innerHTML = html;
12 return sample.firstChild.checkValidity();
13 }
14
15 test(() => {
16 assert_true(checkValidityFor('<fieldset></fieldset>'));
17 }, 'checkValidity() for FIELDSET should return true.');
18
19 test(() => {
20 assert_true(checkValidityFor('<fieldset><input required></fieldset>'));
21 }, 'checkValidity() for FIELDSET with an invalid INPUT should return true.');
22
23 test(() => {
24 assert_true(checkValidityFor('<button>lorem ipsum</button>'));
25 }, 'checkValidity() for BUTTON should return true.');
26
27 test(() => {
28 assert_true(checkValidityFor('<output></output>'));
29 }, 'checkValidity() for OUTPUT should return true.');
30
31 test(() => {
32 assert_true(checkValidityFor('<object></object>'));
33 }, 'checkValidity() for OBJECT should return true.');
34
35 test(() => {
36 assert_true(checkValidityFor('<keygen></keygen>'));
37 }, 'checkValidity() for KEYGEN should return true.');
38
39 test(() => {
40 assert_true(checkValidityFor('<select required>' +
41 ' <option>empty</option>' +
42 ' <option>another</option>' +
43 '</select>'));
44 }, 'checkValidity() for SELECT without a placeholder OPTION should return true.' );
45
46 test(() => {
47 assert_false(checkValidityFor('<select required>' +
48 ' <option value="" selected />' +
49 ' <option value="X">X</option>' +
50 '</select>'));
51 }, 'checkValidity() for SELECT with a placeholder OPTION should return false.');
52
53 test(() => {
54 assert_true(checkValidityFor('<select required>' +
55 ' <option value="X">X</option>' +
56 ' <option value="" selected />' +
57 '</select>'));
58 }, 'checkValidity() for SELECT with a selected empty second OPTION should return true.');
59
60 test(() => {
61 assert_true(checkValidityFor('<form method="get">' +
62 '<fieldset name="victim"></fieldset>' +
63 '<input name="victim" type="text" value="lorem ipsum"/>' +
64 '<button name="victim">lorem ipsum</button>' +
65 '<select name="victim"></select>' +
66 '<textarea name="victim"></textarea>' +
67 '</form>'));
68 }, 'checkValidity() for FORM with valid controls should return true.');
69
70 test(() => {
71 assert_false(checkValidityFor('<form method="get">' +
72 '<fieldset name="victim"></fieldset>' +
73 '<input name="victim" type="text" value="invalid" pattern="something"/>' +
74 '<button name="victim">lorem ipsum</button>' +
75 '<select name="victim"></select>' +
76 '<textarea name="victim"></textarea>' +
77 '</form>'));
78 }, 'checkValidity() for FORM with an invalid control should return false.');
79 </script>
80 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/forms/checkValidity-001.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698