OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body> | 2 <body> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <div id="sample"></div> | 5 <div id="sample"></div> |
6 <script> | 6 <script> |
7 // See also imported/wpt/html/semantics/forms/constraints/form-validation-checkV
alidity.html. | 7 // See also imported/wpt/html/semantics/forms/constraints/form-validation-checkV
alidity.html. |
8 | 8 |
9 function checkValidityFor(html) { | 9 function checkValidityFor(html) { |
10 var sample = document.getElementById('sample'); | 10 var sample = document.getElementById('sample'); |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 test(() => { | 27 test(() => { |
28 assert_true(checkValidityFor('<output></output>')); | 28 assert_true(checkValidityFor('<output></output>')); |
29 }, 'checkValidity() for OUTPUT should return true.'); | 29 }, 'checkValidity() for OUTPUT should return true.'); |
30 | 30 |
31 test(() => { | 31 test(() => { |
32 assert_true(checkValidityFor('<object></object>')); | 32 assert_true(checkValidityFor('<object></object>')); |
33 }, 'checkValidity() for OBJECT should return true.'); | 33 }, 'checkValidity() for OBJECT should return true.'); |
34 | 34 |
35 test(() => { | 35 test(() => { |
36 assert_true(checkValidityFor('<keygen></keygen>')); | |
37 }, 'checkValidity() for KEYGEN should return true.'); | |
38 | |
39 test(() => { | |
40 assert_true(checkValidityFor('<select required>' + | 36 assert_true(checkValidityFor('<select required>' + |
41 ' <option>empty</option>' + | 37 ' <option>empty</option>' + |
42 ' <option>another</option>' + | 38 ' <option>another</option>' + |
43 '</select>')); | 39 '</select>')); |
44 }, 'checkValidity() for SELECT without a placeholder OPTION should return true.'
); | 40 }, 'checkValidity() for SELECT without a placeholder OPTION should return true.'
); |
45 | 41 |
46 test(() => { | 42 test(() => { |
47 assert_false(checkValidityFor('<select required>' + | 43 assert_false(checkValidityFor('<select required>' + |
48 ' <option value="" selected />' + | 44 ' <option value="" selected />' + |
49 ' <option value="X">X</option>' + | 45 ' <option value="X">X</option>' + |
(...skipping 21 matching lines...) Expand all Loading... |
71 assert_false(checkValidityFor('<form method="get">' + | 67 assert_false(checkValidityFor('<form method="get">' + |
72 '<fieldset name="victim"></fieldset>' + | 68 '<fieldset name="victim"></fieldset>' + |
73 '<input name="victim" type="text" value="invalid" pattern="something"/>' + | 69 '<input name="victim" type="text" value="invalid" pattern="something"/>' + |
74 '<button name="victim">lorem ipsum</button>' + | 70 '<button name="victim">lorem ipsum</button>' + |
75 '<select name="victim"></select>' + | 71 '<select name="victim"></select>' + |
76 '<textarea name="victim"></textarea>' + | 72 '<textarea name="victim"></textarea>' + |
77 '</form>')); | 73 '</form>')); |
78 }, 'checkValidity() for FORM with an invalid control should return false.'); | 74 }, 'checkValidity() for FORM with an invalid control should return false.'); |
79 </script> | 75 </script> |
80 </body> | 76 </body> |
OLD | NEW |