| 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 // 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 | |
| 32 // Valid minlength attributes | |
| 33 textArea.setAttribute('minlength', '1'); | |
| 34 shouldBe('textArea.minLength', '1'); | |
| 35 textArea.setAttribute('minlength', '256'); | |
| 36 shouldBe('textArea.minLength', '256'); | |
| 37 | |
| 38 // Set values to .minLength | |
| 39 textArea.minLength = 6; | |
| 40 shouldBe('textArea.getAttribute("minlength")', '"6"'); | |
| 41 | |
| 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."'); | |
| 43 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed | |
| 44 textArea.maxLength = 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)."'); | |
| 46 shouldBe('textArea.getAttribute("minlength")', '"6"'); // Not changed | |
| 47 shouldBe('textArea.minLength = 10; textArea.getAttribute("minlength")', '"10"'); | |
| 48 | |
| 49 textArea.minLength = null; | |
| 50 shouldBe('textArea.minLength', '0'); | |
| 51 shouldBe('textArea.getAttribute("minlength")', '"0"'); | |
| 52 | |
| 53 </script> | |
| 54 </body> | |
| 55 </html> | |
| OLD | NEW |