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

Side by Side Diff: LayoutTests/fast/forms/ValidityState-tooLong-textarea.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 tooLong flag with &lt;textarea> elements.'); 10 description('Tests for tooLong flag with &lt;textarea> elements.');
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 debug(''); 44 debug('');
45 debug('Sets a value via DOM property'); 45 debug('Sets a value via DOM property');
46 textarea = document.createElement('textarea'); 46 textarea = document.createElement('textarea');
47 document.body.appendChild(textarea); 47 document.body.appendChild(textarea);
48 textarea.maxLength = 3; 48 textarea.maxLength = 3;
49 textarea.value = 'abcde'; 49 textarea.value = 'abcde';
50 shouldBeFalse('textarea.validity.tooLong'); 50 shouldBeFalse('textarea.validity.tooLong');
51 51
52 debug(''); 52 debug('');
53 debug('Disabled'); 53 debug('Disabling makes the control valid');
54 textarea.disabled = true; 54 textarea.focus();
55 shouldBeFalse('textarea.validity.tooLong'); 55 textarea.setSelectionRange(5, 5); // Move the cursor at the end.
56 textarea.disabled = false; 56 document.execCommand('delete');
57 shouldBeTrue('textarea.validity.tooLong');
58 shouldBeFalse('textarea.disabled = true; textarea.validity.tooLong');
59 shouldBeTrue('textarea.disabled = false; textarea.validity.tooLong');
57 60
61 // TODO: The grapheme test below doesn't do its job because initial value is
62 // always valid. After making a modificaton to trigger validity check, one can
63 // see that the test would fail, which possibly reveals a code issue.
64 // Once this is figured out, implement a similar test in
65 // ValidityState-tooShort-textarea.html
58 debug(''); 66 debug('');
59 debug('Grapheme length is not greater than maxLength though character length is greater'); 67 debug('Grapheme length is not greater than maxLength though character length is greater');
60 // fancyX should be treated as 1 grapheme. 68 // fancyX should be treated as 1 grapheme.
61 // U+0305 COMBINING OVERLINE 69 // U+0305 COMBINING OVERLINE
62 // U+0332 COMBINING LOW LINE 70 // U+0332 COMBINING LOW LINE
63 var fancyX = "x\u0305\u0332"; 71 var fancyX = "x\u0305\u0332";
64 textarea = document.createElement('textarea'); 72 textarea = document.createElement('textarea');
65 document.body.appendChild(textarea); 73 document.body.appendChild(textarea);
66 textarea.value = fancyX; // 3 characters, 1 grapheme cluster. 74 textarea.value = fancyX; // 3 characters, 1 grapheme cluster.
67 textarea.maxLength = 1; 75 textarea.maxLength = 1;
(...skipping 18 matching lines...) Expand all
86 debug('A value set by a child node change doesn\'t make tooLong true.'); 94 debug('A value set by a child node change doesn\'t make tooLong true.');
87 parent.innerHTML = '<textarea maxlength=2>abc</textarea>'; 95 parent.innerHTML = '<textarea maxlength=2>abc</textarea>';
88 textarea = parent.firstChild; 96 textarea = parent.firstChild;
89 shouldBeFalse('textarea.validity.tooLong'); 97 shouldBeFalse('textarea.validity.tooLong');
90 parent.firstChild.innerHTML = 'abcdef'; 98 parent.firstChild.innerHTML = 'abcdef';
91 shouldBe('textarea.value', '"abcdef"'); 99 shouldBe('textarea.value', '"abcdef"');
92 shouldBeFalse('textarea.validity.tooLong'); 100 shouldBeFalse('textarea.validity.tooLong');
93 </script> 101 </script>
94 </body> 102 </body>
95 </html> 103 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698