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.tooShort</title> | 3 <title>The constraint validation API Test: element.validity.tooShort</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/#suffering-from-be
ing-too-short"> | 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#suffering-from-be
ing-too-short"> |
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", "url", "email", "password"], | 15 types: ["text", "search", "tel", "url", "email", "password"], |
16 testData: [ | 16 testData: [ |
17 // Non-dirty value | 17 // Non-dirty value |
18 {conditions: {minLength: "", value: "abc"}, expected: false, name: "[tar
get] Non-dirty value - minLength is not set"}, | 18 {conditions: {minLength: "", value: "abc"}, expected: false, name: "[tar
get] Non-dirty value - minLength is not set"}, |
19 {conditions: {minLength: "4", value: ""}, expected: false, name: "[targe
t] Non-dirty value - value is empty string"}, | 19 {conditions: {minLength: "4", value: ""}, expected: false, name: "[targe
t] Non-dirty value - value is empty string"}, |
20 {conditions: {minLength: "4", value: "abcde"}, expected: false, name: "[
target] Non-dirty value - length of value is greater than minLength"}, | 20 {conditions: {minLength: "4", value: "abcde"}, expected: false, name: "[
target] Non-dirty value - length of value is greater than minLength"}, |
21 {conditions: {minLength: "4", value: "abcd"}, expected: false, name: "[t
arget] Non-dirty value - length of value equals to minLength"}, | 21 {conditions: {minLength: "4", value: "abcd"}, expected: false, name: "[t
arget] Non-dirty value - length of value equals to minLength"}, |
22 {conditions: {minLength: "4", value: "abc"}, expected: false, name: "[ta
rget] Non-dirty value - length of value is less than minLength"}, | 22 {conditions: {minLength: "4", value: "abc"}, expected: false, name: "[ta
rget] Non-dirty value - length of value is less than minLength"}, |
23 //Dirty value | 23 //Dirty value |
24 {conditions: {minLength: "4", value: "abcde"}, expected: false, name: "[
target] Dirty value - value is greater than minLength", dirty: true}, | 24 {conditions: {minLength: "4", value: "abcde"}, expected: false, name: "[
target] Dirty value - value is greater than minLength", dirty: true}, |
25 {conditions: {minLength: "4", value: "\u0041\u0041\u0041\u0041\u0041"},
expected: false, name: "[target] Dirty value - length of value(AAAAA) in unicode
is greater than minLength", dirty: true}, | 25 {conditions: {minLength: "4", value: "\u0041\u0041\u0041\u0041\u0041"},
expected: false, name: "[target] Dirty value - length of value(AAAAA) in unicode
is greater than minLength", dirty: true}, |
26 {conditions: {minLength: "4", value: "abcd"}, expected: false, name: "[t
arget] Dirty value - value equals to minLength", dirty: true}, | 26 {conditions: {minLength: "4", value: "abcd"}, expected: false, name: "[t
arget] Dirty value - value equals to minLength", dirty: true}, |
27 {conditions: {minLength: "4", value: "abc"}, expected: true, name: "[tar
get] Dirty value - length of value is less than minLength", dirty: true} | 27 // False due to lack of required interactive editing by the user |
| 28 {conditions: {minLength: "4", value: "abc"}, expected: false, name: "[ta
rget] Dirty value - length of value is less than minLength", dirty: true} |
28 ] | 29 ] |
29 }, | 30 }, |
30 { | 31 { |
31 tag: "textarea", | 32 tag: "textarea", |
32 types: [], | 33 types: [], |
33 testData: [ | 34 testData: [ |
34 // Non-dirty value | 35 // Non-dirty value |
35 {conditions: {minLength: "", value: "abc"}, expected: false, name: "[tar
get] Non-dirty value - minLength is no set"}, | 36 {conditions: {minLength: "", value: "abc"}, expected: false, name: "[tar
get] Non-dirty value - minLength is no set"}, |
36 {conditions: {minLength: "4", value: ""}, expected: false, name: "[targe
t] Non-dirty value - value is empty string"}, | 37 {conditions: {minLength: "4", value: ""}, expected: false, name: "[targe
t] Non-dirty value - value is empty string"}, |
37 {conditions: {minLength: "4", value: "abcde"}, expected: false, name: "[
target] Non-dirty value - length of value is greater than minLength"}, | 38 {conditions: {minLength: "4", value: "abcde"}, expected: false, name: "[
target] Non-dirty value - length of value is greater than minLength"}, |
38 {conditions: {minLength: "4", value: "abcd"}, expected: false, name: "[t
arget] Non-dirty value - length of value equals to minLength"}, | 39 {conditions: {minLength: "4", value: "abcd"}, expected: false, name: "[t
arget] Non-dirty value - length of value equals to minLength"}, |
39 {conditions: {minLength: "4", value: "abc"}, expected: false, name: "[ta
rget] Non-dirty value - length of length of value is greater than minLength"}, | 40 {conditions: {minLength: "4", value: "abc"}, expected: false, name: "[ta
rget] Non-dirty value - length of length of value is greater than minLength"}, |
40 //Dirty value | 41 //Dirty value |
41 {conditions: {minLength: "4", value: "abcde"}, expected: false, name: "[
target] Dirty value - value is less than minLength", dirty: true}, | 42 {conditions: {minLength: "4", value: "abcde"}, expected: false, name: "[
target] Dirty value - value is less than minLength", dirty: true}, |
42 {conditions: {minLength: "4", value: "\u000D\u000A\u000D\u000A\u000D\u00
0A"}, expected: false, name: "[target] Dirty value - length of value(LF, CRLF) i
n unicode is less than minLength", dirty: true}, | 43 {conditions: {minLength: "4", value: "\u000D\u000A\u000D\u000A\u000D\u00
0A"}, expected: false, name: "[target] Dirty value - length of value(LF, CRLF) i
n unicode is less than minLength", dirty: true}, |
43 {conditions: {minLength: "4", value: "abcd"}, expected: false, name: "[t
arget] Dirty value - length of value equals to minLength", dirty: true}, | 44 {conditions: {minLength: "4", value: "abcd"}, expected: false, name: "[t
arget] Dirty value - length of value equals to minLength", dirty: true}, |
44 {conditions: {minLength: "4", value: "abc"}, expected: true, name: "[tar
get] Dirty value - length of value is greater than minLength", dirty: true} | 45 // False due to lack of required interactive editing by the user |
| 46 {conditions: {minLength: "4", value: "abc"}, expected: false, name: "[ta
rget] Dirty value - length of value is greater than minLength", dirty: true} |
45 ] | 47 ] |
46 } | 48 } |
47 ]; | 49 ]; |
48 | 50 |
49 validator.run_test (testElements, "tooShort"); | 51 validator.run_test (testElements, "tooShort"); |
50 </script> | 52 </script> |
OLD | NEW |