OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
3 <title>The constraint validation API Test: element.validity.valid</title> | 3 <title>The constraint validation API Test: element.validity.valid</title> |
4 <link rel="author" title="Intel" href="http://www.intel.com/"> | 4 <link rel="author" title="Intel" href="http://www.intel.com/"> |
5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-validitystate
-valid"> | 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-validitystate
-valid"> |
6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-constraint-va
lidation-api"> | 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-constraint-va
lidation-api"> |
7 <script src="/resources/testharness.js"></script> | 7 <script src="/resources/testharness.js"></script> |
8 <script src="/resources/testharnessreport.js"></script> | 8 <script src="/resources/testharnessreport.js"></script> |
9 <script src="support/validator.js"></script> | 9 <script src="support/validator.js"></script> |
10 <div id="log"></div> | 10 <div id="log"></div> |
11 <script> | 11 <script> |
12 var testElements = [ | 12 var testElements = [ |
13 { | 13 { |
14 tag: "input", | 14 tag: "input", |
15 types: ["text", "search", "tel", "password"], | 15 types: ["text", "search", "tel", "password"], |
16 testData: [ | 16 testData: [ |
17 {conditions: {maxLength: "4", value: "abcdef"}, expected: false, name: "
[target] validity.valid must be false if validity.tooLong is true", dirty: true}
, | |
18 {conditions: {pattern: "[A-Z]", value: "abc"}, expected: false, name: "[
target] validity.valid must be false if validity.patternMismatch is true"}, | 17 {conditions: {pattern: "[A-Z]", value: "abc"}, expected: false, name: "[
target] validity.valid must be false if validity.patternMismatch is true"}, |
19 {conditions: {required: true, value: ""}, expected: false, name: "[targe
t] validity.valid must be false if validity.valueMissing is true"} | 18 {conditions: {required: true, value: ""}, expected: false, name: "[targe
t] validity.valid must be false if validity.valueMissing is true"} |
20 ] | 19 ] |
21 }, | 20 }, |
22 { | 21 { |
23 tag: "input", | 22 tag: "input", |
24 types: ["url"], | 23 types: ["url"], |
25 testData: [ | 24 testData: [ |
26 {conditions: {maxLength: "20", value: "http://www.example.com"}, expecte
d: false, name: "[target] validity.valid must be false if validity.tooLong is tr
ue", dirty: true}, | |
27 {conditions: {pattern: "http://www.example.com", value: "http://www.exam
ple.net"}, expected: false, name: "[target] validity.valid must be false if vali
dity.patternMismatch is true"}, | 25 {conditions: {pattern: "http://www.example.com", value: "http://www.exam
ple.net"}, expected: false, name: "[target] validity.valid must be false if vali
dity.patternMismatch is true"}, |
28 {conditions: {value: "abc"}, expected: false, name: "[target] validity.v
alid must be false if validity.typeMismatch is true"}, | 26 {conditions: {value: "abc"}, expected: false, name: "[target] validity.v
alid must be false if validity.typeMismatch is true"}, |
29 {conditions: {required: true, value: ""}, expected: false, name: "[targe
t] validity.valid must be false if validity.valueMissing is true"} | 27 {conditions: {required: true, value: ""}, expected: false, name: "[targe
t] validity.valid must be false if validity.valueMissing is true"} |
30 ] | 28 ] |
31 }, | 29 }, |
32 { | 30 { |
33 tag: "input", | 31 tag: "input", |
34 types: ["email"], | 32 types: ["email"], |
35 testData: [ | 33 testData: [ |
36 {conditions: {maxLength: "10", value: "test@example.com"}, expected: fal
se, name: "[target] validity.valid must be false if validity.tooLong is true", d
irty: true}, | |
37 {conditions: {pattern: "test@example.com", value: "test@example.net"}, e
xpected: false, name: "[target] validity.valid must be false if validity.pattern
Mismatch is true"}, | 34 {conditions: {pattern: "test@example.com", value: "test@example.net"}, e
xpected: false, name: "[target] validity.valid must be false if validity.pattern
Mismatch is true"}, |
38 {conditions: {value: "abc"}, expected: false, name: "[target] validity.v
alid must be false if validity.typeMismatch is true"}, | 35 {conditions: {value: "abc"}, expected: false, name: "[target] validity.v
alid must be false if validity.typeMismatch is true"}, |
39 {conditions: {required: true, value: ""}, expected: false, name: "[targe
t] validity.valid must be false if validity.valueMissing is true"} | 36 {conditions: {required: true, value: ""}, expected: false, name: "[targe
t] validity.valid must be false if validity.valueMissing is true"} |
40 ] | 37 ] |
41 }, | 38 }, |
42 { | 39 { |
43 tag: "input", | 40 tag: "input", |
44 types: ["datetime-local"], | 41 types: ["datetime-local"], |
45 testData: [ | 42 testData: [ |
46 {conditions: {max: "2000-01-01T12:00:00", value: "2001-01-01T12:00:00"},
expected: false, name: "[target] validity.valid must be false if validity.range
Overflow is true"}, | 43 {conditions: {max: "2000-01-01T12:00:00", value: "2001-01-01T12:00:00"},
expected: false, name: "[target] validity.valid must be false if validity.range
Overflow is true"}, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 tag: "textarea", | 121 tag: "textarea", |
125 types: [], | 122 types: [], |
126 testData: [ | 123 testData: [ |
127 {conditions: {required: true, value: ""}, expected: false, name: "[targe
t] validity.valid must be false if validity.valueMissing is true"} | 124 {conditions: {required: true, value: ""}, expected: false, name: "[targe
t] validity.valid must be false if validity.valueMissing is true"} |
128 ] | 125 ] |
129 } | 126 } |
130 ]; | 127 ]; |
131 | 128 |
132 validator.run_test(testElements, "isValid"); | 129 validator.run_test(testElements, "isValid"); |
133 </script> | 130 </script> |
OLD | NEW |