| OLD | NEW |
| 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 HTMLTextAreaElement.maxLength behaviors.'); | 10 description('Tests for HTMLTextAreaElement.maxLength behaviors.'); |
| 11 | 11 |
| 12 var textArea = document.createElement('textarea'); | 12 var textArea = document.createElement('textarea'); |
| 13 document.body.appendChild(textArea); | 13 document.body.appendChild(textArea); |
| 14 | 14 |
| 15 // No maxlength attribute | 15 // No maxlength attribute |
| 16 shouldBe('textArea.maxLength', '-1'); | 16 shouldBe('textArea.maxLength', '-1'); |
| 17 | 17 |
| 18 // Invalid maxlength attributes | 18 // Invalid maxlength attributes |
| 19 textArea.setAttribute('maxlength', '-3'); | 19 textArea.setAttribute('maxlength', '-3'); |
| 20 shouldBe('textArea.maxLength', '-1'); | 20 shouldBe('textArea.maxLength', '-1'); |
| 21 textArea.setAttribute('maxlength', 'xyz'); | 21 textArea.setAttribute('maxlength', 'xyz'); |
| 22 shouldBe('textArea.maxLength', '-1'); | 22 shouldBe('textArea.maxLength', '-1'); |
| 23 | 23 |
| 24 // Leading whitespaces in maxlength attributes |
| 25 textArea.setAttribute('maxlength', '\t \n\r1'); |
| 26 shouldBe('textArea.maxLength', '1'); |
| 27 textArea.setAttribute('maxlength', "\u20021"); |
| 28 shouldBe('textArea.maxLength', '-1'); |
| 29 textArea.setAttribute('maxlength', "\u20091"); |
| 30 shouldBe('textArea.maxLength', '-1'); |
| 31 |
| 24 // Valid maxlength attributes | 32 // Valid maxlength attributes |
| 25 textArea.setAttribute('maxlength', '1'); | 33 textArea.setAttribute('maxlength', '1'); |
| 26 shouldBe('textArea.maxLength', '1'); | 34 shouldBe('textArea.maxLength', '1'); |
| 27 textArea.setAttribute('maxlength', '256'); | 35 textArea.setAttribute('maxlength', '256'); |
| 28 shouldBe('textArea.maxLength', '256'); | 36 shouldBe('textArea.maxLength', '256'); |
| 29 | 37 |
| 30 // Set values to .maxLength | 38 // Set values to .maxLength |
| 31 textArea.maxLength = 13; | 39 textArea.maxLength = 13; |
| 32 shouldBe('textArea.getAttribute("maxlength")', '"13"'); | 40 shouldBe('textArea.getAttribute("maxlength")', '"13"'); |
| 33 | 41 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 shouldBe('textArea.value', '"ABC"'); | 169 shouldBe('textArea.value', '"ABC"'); |
| 162 | 170 |
| 163 // In the case maxlength='invalid' | 171 // In the case maxlength='invalid' |
| 164 createFocusedTextAreaWithMaxLength('invalid'); | 172 createFocusedTextAreaWithMaxLength('invalid'); |
| 165 textArea.value = ''; | 173 textArea.value = ''; |
| 166 document.execCommand('insertText', false, 'ABC'); | 174 document.execCommand('insertText', false, 'ABC'); |
| 167 shouldBe('textArea.value', '"ABC"'); | 175 shouldBe('textArea.value', '"ABC"'); |
| 168 </script> | 176 </script> |
| 169 </body> | 177 </body> |
| 170 </html> | 178 </html> |
| OLD | NEW |