Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / textarea-minlength.html
blobda0f489370f8e7e269313a34ed19ba0e40d77d57
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.');
12 var textArea = document.createElement('textarea');
13 document.body.appendChild(textArea);
15 // No minlength attribute
16 shouldBe('textArea.minLength', '-1');
18 // Invalid minlength attributes
19 textArea.setAttribute('minlength', '-3');
20 shouldBe('textArea.minLength', '-1');
21 textArea.setAttribute('minlength', 'xyz');
22 shouldBe('textArea.minLength', '-1');
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');
32 // Valid minlength attributes
33 textArea.setAttribute('minlength', '1');
34 shouldBe('textArea.minLength', '1');
35 textArea.setAttribute('minlength', '256');
36 shouldBe('textArea.minLength', '256');
38 // Set values to .minLength
39 textArea.minLength = 6;
40 shouldBe('textArea.getAttribute("minlength")', '"6"');
42 shouldThrow('textArea.minLength = -1', '"IndexSizeError: Failed to set the \'minLength\' property on \'HTMLTextAreaElement\': The value provided (-1) is not positive or 0."');
43 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed
44 textArea.maxLength = 10;
45 shouldThrow('textArea.minLength = 11', '"IndexSizeError: Failed to set the \'minLength\' property on \'HTMLTextAreaElement\': The minLength provided (11) is greater than the maximum bound (10)."');
46 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed
47 shouldBe('textArea.minLength = 10; textArea.getAttribute("minlength")', '"10"');
49 textArea.minLength = null;
50 shouldBe('textArea.minLength', '0');
51 shouldBe('textArea.getAttribute("minlength")', '"0"');
53 </script>
54 </body>
55 </html>