OLD | NEW |
(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> |
OLD | NEW |