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

Side by Side Diff: LayoutTests/fast/forms/textarea-minlength.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, 1 month 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.minLength behaviors.'); 10 description('Tests for HTMLTextAreaElement.minLength 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 minlength attribute 15 // No minlength attribute
16 shouldBe('textArea.minLength', '-1'); 16 shouldBe('textArea.minLength', '-1');
17 17
18 // Invalid minlength attributes 18 // Invalid minlength attributes
19 textArea.setAttribute('minlength', '-3'); 19 textArea.setAttribute('minlength', '-3');
20 shouldBe('textArea.minLength', '-1'); 20 shouldBe('textArea.minLength', '-1');
21 textArea.setAttribute('minlength', 'xyz'); 21 textArea.setAttribute('minlength', 'xyz');
22 shouldBe('textArea.minLength', '-1'); 22 shouldBe('textArea.minLength', '-1');
23 23
24 // Leading whitespaces in minlength attributes
25 textArea.setAttribute('minlength', '\t \n\r1');
26 shouldBe('textArea.minLength', '1');
27 textArea.setAttribute('minlength', "\u20021");
28 shouldBe('textArea.minLength', '-1');
29 textArea.setAttribute('minlength', "\u20091");
30 shouldBe('textArea.minLength', '-1');
31
24 // Valid minlength attributes 32 // Valid minlength attributes
25 textArea.setAttribute('minlength', '1'); 33 textArea.setAttribute('minlength', '1');
26 shouldBe('textArea.minLength', '1'); 34 shouldBe('textArea.minLength', '1');
27 textArea.setAttribute('minlength', '256'); 35 textArea.setAttribute('minlength', '256');
28 shouldBe('textArea.minLength', '256'); 36 shouldBe('textArea.minLength', '256');
29 37
30 // Set values to .minLength 38 // Set values to .minLength
31 textArea.minLength = 6; 39 textArea.minLength = 6;
32 shouldBe('textArea.getAttribute("minlength")', '"6"'); 40 shouldBe('textArea.getAttribute("minlength")', '"6"');
33 41
34 shouldThrow('textArea.minLength = -1', '"IndexSizeError: Failed to set the \'min Length\' property on \'HTMLTextAreaElement\': The value provided (-1) is not pos itive or 0."'); 42 shouldThrow('textArea.minLength = -1', '"IndexSizeError: Failed to set the \'min Length\' property on \'HTMLTextAreaElement\': The value provided (-1) is not pos itive or 0."');
35 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed 43 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed
36 textArea.maxLength = 10; 44 textArea.maxLength = 10;
37 shouldThrow('textArea.minLength = 11', '"IndexSizeError: Failed to set the \'min Length\' property on \'HTMLTextAreaElement\': The minLength provided (11) is gre ater than the maximum bound (10)."'); 45 shouldThrow('textArea.minLength = 11', '"IndexSizeError: Failed to set the \'min Length\' property on \'HTMLTextAreaElement\': The minLength provided (11) is gre ater than the maximum bound (10)."');
38 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed 46 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed
39 shouldBe('textArea.minLength = 10; textArea.getAttribute("minlength")', '"10"'); 47 shouldBe('textArea.minLength = 10; textArea.getAttribute("minlength")', '"10"');
40 48
41 textArea.minLength = null; 49 textArea.minLength = null;
42 shouldBe('textArea.minLength', '0'); 50 shouldBe('textArea.minLength', '0');
43 shouldBe('textArea.getAttribute("minlength")', '"0"'); 51 shouldBe('textArea.getAttribute("minlength")', '"0"');
44 52
45 </script> 53 </script>
46 </body> 54 </body>
47 </html> 55 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/textarea-maxlength-expected.txt ('k') | LayoutTests/fast/forms/textarea-minlength-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698