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

Side by Side Diff: LayoutTests/fast/forms/validationMessage.html

Issue 435753003: Implement minlength for <input> and <textarea>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add more layout tests Created 6 years, 2 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
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <p id="description"></p> 7 <p id="description"></p>
8 <div id="console"></div> 8 <div id="console"></div>
9 <script> 9 <script>
10 description("Test for validationMessage DOM property."); 10 description("Test for validationMessage DOM property.");
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 inputWithMax.lang = "ar-eg"; 121 inputWithMax.lang = "ar-eg";
122 debug("input tooLong: " + inputWithMax.validationMessage); 122 debug("input tooLong: " + inputWithMax.validationMessage);
123 123
124 var textarea = document.createElement("textarea"); 124 var textarea = document.createElement("textarea");
125 document.body.appendChild(textarea); 125 document.body.appendChild(textarea);
126 textarea.focus(); 126 textarea.focus();
127 document.execCommand("inserttext", false, "a\nbc"); 127 document.execCommand("inserttext", false, "a\nbc");
128 textarea.maxLength = 3; 128 textarea.maxLength = 3;
129 debug("textarea tooLong: " + textarea.validationMessage); 129 debug("textarea tooLong: " + textarea.validationMessage);
130 130
131 debug("tooShort:");
132 var inputWithMin = document.createElement("input");
133 inputWithMin.minLength = 3;
134 inputWithMin.value = "ab";
135 document.body.appendChild(inputWithMin);
136 inputWithMin.focus();
137 document.execCommand("delete");
138 debug("input tooShort: " + inputWithMin.validationMessage);
139 // fancyX should be treated as 3 characters.
140 // U+0305 COMBINING OVERLINE
141 // U+0332 COMBINING LOW LINE
142 var fancyX = "x\u0305\u0332";
143 inputWithMin.minLength = 4;
144 inputWithMin.value = fancyX + "X";
145 inputWithMin.focus();
146 inputWithMin.setSelectionRange(4, 4);
147 document.execCommand("delete");
148 debug("input tooShort: " + inputWithMin.validationMessage);
149 // The following test might show English text + Arabic digits. It's expected and
150 // it never happens in products.
151 inputWithMin.lang = "ar-eg";
152 debug("input tooShort: " + inputWithMin.validationMessage);
153
154 var textarea = document.createElement("textarea");
155 document.body.appendChild(textarea);
156 textarea.focus();
157 document.execCommand("inserttext", false, "a\n");
158 textarea.minLength = 4;
159 debug("textarea tooShort: " + textarea.validationMessage);
160
131 // A button can't be valited and, thus, has a blank validationMessage 161 // A button can't be valited and, thus, has a blank validationMessage
132 var but = document.createElement("button"); 162 var but = document.createElement("button");
133 but.name = "button"; 163 but.name = "button";
134 form.appendChild(but); 164 form.appendChild(but);
135 shouldBe("but.validationMessage", "''"); 165 shouldBe("but.validationMessage", "''");
136 166
137 // An input control with no name, so it can't be validated (willValidate = false ) 167 // An input control with no name, so it can't be validated (willValidate = false )
138 var anoninput = document.createElement("input"); 168 var anoninput = document.createElement("input");
139 form.appendChild(anoninput); 169 form.appendChild(anoninput);
140 shouldBe("anoninput.validationMessage", "''") 170 shouldBe("anoninput.validationMessage", "''")
(...skipping 25 matching lines...) Expand all
166 // Keygen controls can't be validated 196 // Keygen controls can't be validated
167 var happyKeygen = document.createElement("keygen"); 197 var happyKeygen = document.createElement("keygen");
168 happySelect.name = "keygen"; 198 happySelect.name = "keygen";
169 form.appendChild(happyKeygen); 199 form.appendChild(happyKeygen);
170 shouldBe("happyKeygen.validationMessage", "''"); 200 shouldBe("happyKeygen.validationMessage", "''");
171 201
172 form.remove(); 202 form.remove();
173 </script> 203 </script>
174 </body> 204 </body>
175 </html> 205 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698