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

Side by Side Diff: LayoutTests/fast/forms/textarea-maxlength.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('Tests for HTMLTextAreaElement.maxLength behaviors.'); 10 description('Tests for HTMLTextAreaElement.maxLength behaviors.');
(...skipping 15 matching lines...) Expand all
26 shouldBe('textArea.maxLength', '1'); 26 shouldBe('textArea.maxLength', '1');
27 textArea.setAttribute('maxlength', '256'); 27 textArea.setAttribute('maxlength', '256');
28 shouldBe('textArea.maxLength', '256'); 28 shouldBe('textArea.maxLength', '256');
29 29
30 // Set values to .maxLength 30 // Set values to .maxLength
31 textArea.maxLength = 13; 31 textArea.maxLength = 13;
32 shouldBe('textArea.getAttribute("maxlength")', '"13"'); 32 shouldBe('textArea.getAttribute("maxlength")', '"13"');
33 33
34 shouldThrow('textArea.maxLength = -1', '"IndexSizeError: Failed to set the \'max Length\' property on \'HTMLTextAreaElement\': The value provided (-1) is not pos itive or 0."'); 34 shouldThrow('textArea.maxLength = -1', '"IndexSizeError: Failed to set the \'max Length\' property on \'HTMLTextAreaElement\': The value provided (-1) is not pos itive or 0."');
35 shouldBe('textArea.getAttribute("maxlength")', '"13"'); // Not changed 35 shouldBe('textArea.getAttribute("maxlength")', '"13"'); // Not changed
36 textArea.minLength = 11;
37 shouldThrow('textArea.maxLength = 10', '"IndexSizeError: Failed to set the \'max Length\' property on \'HTMLTextAreaElement\': The maxLength provided (10) is les s than the minimum bound (11)."');
38 shouldBe('textArea.getAttribute("maxlength")', '"13"'); // Not changed
39 shouldBe('textArea.maxLength = 11; textArea.getAttribute("maxlength")', '"11"');
40 textArea.minLength = 0; // Remove the minlength value to get it out of the way of subsequent tests
36 41
37 textArea.maxLength = null; 42 textArea.maxLength = null;
38 shouldBe('textArea.maxLength', '0'); 43 shouldBe('textArea.maxLength', '0');
39 shouldBe('textArea.getAttribute("maxlength")', '"0"'); 44 shouldBe('textArea.getAttribute("maxlength")', '"0"');
40 45
41 // maxLength doesn't truncate the default value. 46 // maxLength doesn't truncate the default value.
42 textArea = document.createElement('textarea'); 47 textArea = document.createElement('textarea');
43 textArea.setAttribute('maxlength', '3'); 48 textArea.setAttribute('maxlength', '3');
44 textArea.innerHTML = 'abcd'; 49 textArea.innerHTML = 'abcd';
45 document.body.appendChild(textArea); 50 document.body.appendChild(textArea);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 shouldBe('textArea.value', '"ABC"'); 161 shouldBe('textArea.value', '"ABC"');
157 162
158 // In the case maxlength='invalid' 163 // In the case maxlength='invalid'
159 createFocusedTextAreaWithMaxLength('invalid'); 164 createFocusedTextAreaWithMaxLength('invalid');
160 textArea.value = ''; 165 textArea.value = '';
161 document.execCommand('insertText', false, 'ABC'); 166 document.execCommand('insertText', false, 'ABC');
162 shouldBe('textArea.value', '"ABC"'); 167 shouldBe('textArea.value', '"ABC"');
163 </script> 168 </script>
164 </body> 169 </body>
165 </html> 170 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698