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

Side by Side Diff: LayoutTests/fast/forms/textarea-minlength.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
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description('Tests for HTMLTextAreaElement.minLength behaviors.');
11
12 var textArea = document.createElement('textarea');
13 document.body.appendChild(textArea);
14
15 // No minlength attribute
16 shouldBe('textArea.minLength', '-1');
17
18 // Invalid minlength attributes
19 textArea.setAttribute('minlength', '-3');
20 shouldBe('textArea.minLength', '-1');
21 textArea.setAttribute('minlength', 'xyz');
22 shouldBe('textArea.minLength', '-1');
23
24 // Valid minlength attributes
25 textArea.setAttribute('minlength', '1');
26 shouldBe('textArea.minLength', '1');
27 textArea.setAttribute('minlength', '256');
28 shouldBe('textArea.minLength', '256');
29
30 // Set values to .minLength
31 textArea.minLength = 6;
32 shouldBe('textArea.getAttribute("minlength")', '"6"');
33
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."');
35 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed
36 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)."');
38 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed
39 shouldBe('textArea.minLength = 10; textArea.getAttribute("minlength")', '"10"');
40
41 textArea.minLength = null;
42 shouldBe('textArea.minLength', '0');
43 shouldBe('textArea.getAttribute("minlength")', '"0"');
44
45 </script>
46 </body>
47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698