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

Side by Side Diff: LayoutTests/fast/forms/textarea-maxlength.html

Issue 656683005: Use parseHTMLInteger for parsing minlength and maxlength in <textarea> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout tests that check for leading non-ASCII whitespaces in min/maxlength attribute 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/textarea-maxlength-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.');
11 11
12 var textArea = document.createElement('textarea'); 12 var textArea = document.createElement('textarea');
13 document.body.appendChild(textArea); 13 document.body.appendChild(textArea);
14 14
15 // No maxlength attribute 15 // No maxlength attribute
16 shouldBe('textArea.maxLength', '-1'); 16 shouldBe('textArea.maxLength', '-1');
17 17
18 // Invalid maxlength attributes 18 // Invalid maxlength attributes
19 textArea.setAttribute('maxlength', '-3'); 19 textArea.setAttribute('maxlength', '-3');
20 shouldBe('textArea.maxLength', '-1'); 20 shouldBe('textArea.maxLength', '-1');
21 textArea.setAttribute('maxlength', 'xyz'); 21 textArea.setAttribute('maxlength', 'xyz');
22 shouldBe('textArea.maxLength', '-1'); 22 shouldBe('textArea.maxLength', '-1');
23 23
24 // Leading whitespaces in maxlength attributes
25 textArea.setAttribute('maxlength', '\t \n\r1');
26 shouldBe('textArea.maxLength', '1');
27 textArea.setAttribute('maxlength', "\u20021");
28 shouldBe('textArea.maxLength', '-1');
29 textArea.setAttribute('maxlength', "\u20091");
30 shouldBe('textArea.maxLength', '-1');
31
24 // Valid maxlength attributes 32 // Valid maxlength attributes
25 textArea.setAttribute('maxlength', '1'); 33 textArea.setAttribute('maxlength', '1');
26 shouldBe('textArea.maxLength', '1'); 34 shouldBe('textArea.maxLength', '1');
27 textArea.setAttribute('maxlength', '256'); 35 textArea.setAttribute('maxlength', '256');
28 shouldBe('textArea.maxLength', '256'); 36 shouldBe('textArea.maxLength', '256');
29 37
30 // Set values to .maxLength 38 // Set values to .maxLength
31 textArea.maxLength = 13; 39 textArea.maxLength = 13;
32 shouldBe('textArea.getAttribute("maxlength")', '"13"'); 40 shouldBe('textArea.getAttribute("maxlength")', '"13"');
33 41
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 shouldBe('textArea.value', '"ABC"'); 169 shouldBe('textArea.value', '"ABC"');
162 170
163 // In the case maxlength='invalid' 171 // In the case maxlength='invalid'
164 createFocusedTextAreaWithMaxLength('invalid'); 172 createFocusedTextAreaWithMaxLength('invalid');
165 textArea.value = ''; 173 textArea.value = '';
166 document.execCommand('insertText', false, 'ABC'); 174 document.execCommand('insertText', false, 'ABC');
167 shouldBe('textArea.value', '"ABC"'); 175 shouldBe('textArea.value', '"ABC"');
168 </script> 176 </script>
169 </body> 177 </body>
170 </html> 178 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/textarea-maxlength-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698