5a7bf3da1bff270d5dc6863f68dc8447a8888989
[WebKit.git] / LayoutTests / fast / forms / ValidityState-patternMismatch.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
5 <script src="../../fast/js/resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10 <input id="simple" pattern="[0-9][A-Z]{3}" value="0AAA"
11 /><input id="no-pattern-and-no-value" 
12 /><input id="ip-address" type="text" pattern="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" value="127.0.0.1" 
13 /><input id="email-address" type="text" pattern="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?" value="someone@somewhere.com" 
14 /><input id="wrong-email-address" type="text" pattern="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?" value="Wrong!"
15 /><input id="match-1" type="text" pattern="\b(word1|word2|word3)(?:\W+\w+){1,6}?\W+(word1|word2|word3)\b" value="word1 near word2" 
16 /><input id="match-2" type="text" pattern=".{5,}" value="12345" 
17 /><input id="match-3" type="text" pattern=".{5,}" value="*(@$!" 
18 /><input id="match-4" type="text" pattern=".{5,}" value="*(@^$!" 
19 /><input id="match-5" type="text" pattern="0|1|2|3|4|5|6|7|8|" value="3" 
20 /><input id="match-6" type="text" pattern="^(foo).*" value="foo"
21 /><input id="match-7" type="text" pattern="^(foo).*" value="fooo"
22 /><input id="match-8" type="text" pattern="\w" value="f"
23 /><input id="match-9" type="text" pattern="\." value="."
24 /><input id="match-10" type="text" pattern="\)\(" value=")("
25 /><input id="match-11" type="text" pattern="ab" value="ab"
26 /><input id="match-12" type="text" pattern="^ab" value="ab"
27 /><input id="match-13" type="text" pattern="^\(" value="("
28 /><input id="match-14" type="text" pattern="...\)\(..." value="aaa)(bbb"
29 /><input id="match-15" type="text" pattern="^" value=""
30 /><input id="match-16" type="text" pattern="$" value=""
31 /><input id="match-17" type="text" pattern="foobar" value=""
32 /><input id="wrong-gray-or-grey" type="text" pattern="gr[ae]y" value="Wrong!"
33 /><input id="gray" type="text" pattern="gr[ae]y" value="gray"
34 /><input id="grey" type="text" pattern="gr[ae]y" value="grey"
35 /><input id="empty-gray-or-grey" type="text" pattern="gr[ae]y" value=""
36 /><input id="mismatch-1" type="text" pattern="((4\.[0-3])|(2\.[0-3]))" value="Something 4.0"
37 /><input id="mismatch-2" type="text" pattern="\w" value="*"
38 /><input id="mismatch-3" type="email" pattern="[0-9]" value="something"
39 /><input id="mismatch-4" type="text" pattern=".{5,}" value="1234" 
40 /><input id="mismatch-5" type="text" pattern=".{5,}" value="*)$!" 
41 /><input id="mismatch-6" type="text" pattern=".{5,}" value="(^$!" 
42 /><input id="mismatch-7" type="text" pattern="0|1|2|3|4|5|6|7|8|" value="a" 
43 /><input id="mismatch-8" type="text" pattern="^(foo).*" value="a foo"
44 /><input id="mismatch-9" type="text" pattern="\w" value="134"
45 /><input id="mismatch-10" type="text" pattern="\." value="\."
46 /><input id="mismatch-11" type="text" pattern="\)\(" value=") ("
47 /><input id="mismatch-12" type="text" pattern="ab" value="a"
48 /><input id="mismatch-13" type="text" pattern="ab" value="b"
49 /><input id="mismatch-14" type="text" pattern="^ab" value="abc"
50 /><input id="mismatch-15" type="text" pattern="^\(" value="(something"
51 /><input id="mismatch-16" type="text" pattern="\)\\" value="something)\"
52 /><input id="mismatch-17" type="text" pattern="...\)\([b]{3}" value="adf)(bbbTEST"
53 /><input id="mismatch-18" type="text" pattern="foo\\" value="food"
54 /><input id="mismatch-19" type="text" pattern="^" value="wrong"
55 /><input id="mismatch-20" type="text" pattern="$" value="wrong"
56 /><input id="empty-pattern" type="text" pattern="" value="Lorem Ipsum"
57 /><input id="disabled" pattern="[0-9][A-Z]{3}" value="00AA" disabled />
58 <script language="JavaScript" type="text/javascript">
59 function patternMismatchFor(id) {
60     return document.getElementById(id).validity.patternMismatch;
61 }
62
63 description("This test checks validity.patternMismatch.");
64
65 shouldBeFalse('patternMismatchFor("simple")');
66 shouldBeFalse('patternMismatchFor("no-pattern-and-no-value")');
67 shouldBeFalse('patternMismatchFor("ip-address")');
68 shouldBeFalse('patternMismatchFor("email-address")');
69 shouldBeTrue('patternMismatchFor("wrong-email-address")');
70
71 shouldBeFalse('patternMismatchFor("match-1")');
72 shouldBeFalse('patternMismatchFor("match-2")');
73 shouldBeFalse('patternMismatchFor("match-3")');
74 shouldBeFalse('patternMismatchFor("match-4")');
75 shouldBeFalse('patternMismatchFor("match-5")');
76 shouldBeFalse('patternMismatchFor("match-6")');
77 shouldBeFalse('patternMismatchFor("match-7")');
78 shouldBeFalse('patternMismatchFor("match-8")');
79 shouldBeFalse('patternMismatchFor("match-9")');
80 shouldBeFalse('patternMismatchFor("match-10")');
81 shouldBeFalse('patternMismatchFor("match-11")');
82 shouldBeFalse('patternMismatchFor("match-12")');
83 shouldBeFalse('patternMismatchFor("match-13")');
84 shouldBeFalse('patternMismatchFor("match-14")');
85 shouldBeFalse('patternMismatchFor("match-15")');
86 shouldBeFalse('patternMismatchFor("match-16")');
87 shouldBeFalse('patternMismatchFor("match-17")');
88
89 shouldBeTrue('patternMismatchFor("wrong-gray-or-grey")');
90 shouldBeFalse('patternMismatchFor("gray")');
91 shouldBeFalse('patternMismatchFor("grey")');
92 shouldBeFalse('patternMismatchFor("empty-gray-or-grey")');
93
94 shouldBeTrue('patternMismatchFor("mismatch-1")');
95 shouldBeTrue('patternMismatchFor("mismatch-2")');
96 shouldBeTrue('patternMismatchFor("mismatch-3")');
97 shouldBeTrue('patternMismatchFor("mismatch-4")');
98 shouldBeTrue('patternMismatchFor("mismatch-5")');
99 shouldBeTrue('patternMismatchFor("mismatch-6")');
100 shouldBeTrue('patternMismatchFor("mismatch-7")');
101 shouldBeTrue('patternMismatchFor("mismatch-8")');
102 shouldBeTrue('patternMismatchFor("mismatch-9")');
103 shouldBeTrue('patternMismatchFor("mismatch-10")');
104 shouldBeTrue('patternMismatchFor("mismatch-11")');
105 shouldBeTrue('patternMismatchFor("mismatch-12")');
106 shouldBeTrue('patternMismatchFor("mismatch-13")');
107 shouldBeTrue('patternMismatchFor("mismatch-14")');
108 shouldBeTrue('patternMismatchFor("mismatch-15")');
109 shouldBeTrue('patternMismatchFor("mismatch-16")');
110 shouldBeTrue('patternMismatchFor("mismatch-17")');
111 shouldBeTrue('patternMismatchFor("mismatch-18")');
112 shouldBeTrue('patternMismatchFor("mismatch-19")');
113 shouldBeTrue('patternMismatchFor("mismatch-20")');
114
115 shouldBeFalse('patternMismatchFor("empty-pattern")');
116
117 shouldBeTrue('patternMismatchFor("disabled")');
118
119 var successfullyParsed = true;
120 </script>
121 <script src="../../fast/js/resources/js-test-post.js"></script>
122 </body>
123 </html>