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="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.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.'); |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Valid maxlength attributes | 24 // Valid maxlength attributes |
25 textArea.setAttribute('maxlength', '1'); | 25 textArea.setAttribute('maxlength', '1'); |
26 shouldBe('textArea.maxLength', '1'); | 26 shouldBe('textArea.maxLength', '1'); |
27 textArea.setAttribute('maxlength', '256'); | 27 textArea.setAttribute('maxlength', '256'); |
28 shouldBe('textArea.maxLength', '256'); | 28 shouldBe('textArea.maxLength', '256'); |
29 | 29 |
30 // Set values to .maxLength | 30 // Set values to .maxLength |
31 textArea.maxLength = 13; | 31 textArea.maxLength = 13; |
32 shouldBe('textArea.getAttribute("maxlength")', '"13"'); | 32 shouldBe('textArea.getAttribute("maxlength")', '"13"'); |
33 | 33 |
34 shouldThrow('textArea.maxLength = -1', '"Error: IndexSizeError: DOM Exception 1"
'); | 34 shouldThrow('textArea.maxLength = -1', '"IndexSizeError: Index or size was negat
ive, or greater than the allowed value."'); |
35 shouldBe('textArea.getAttribute("maxlength")', '"13"'); // Not changed | 35 shouldBe('textArea.getAttribute("maxlength")', '"13"'); // Not changed |
36 | 36 |
37 textArea.maxLength = null; | 37 textArea.maxLength = null; |
38 shouldBe('textArea.maxLength', '0'); | 38 shouldBe('textArea.maxLength', '0'); |
39 shouldBe('textArea.getAttribute("maxlength")', '"0"'); | 39 shouldBe('textArea.getAttribute("maxlength")', '"0"'); |
40 | 40 |
41 // maxLength doesn't truncate the default value. | 41 // maxLength doesn't truncate the default value. |
42 textArea = document.createElement('textarea'); | 42 textArea = document.createElement('textarea'); |
43 textArea.setAttribute('maxlength', '3'); | 43 textArea.setAttribute('maxlength', '3'); |
44 textArea.innerHTML = 'abcd'; | 44 textArea.innerHTML = 'abcd'; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 // In the case maxlength='invalid' | 158 // In the case maxlength='invalid' |
159 createFocusedTextAreaWithMaxLength('invalid'); | 159 createFocusedTextAreaWithMaxLength('invalid'); |
160 textArea.value = ''; | 160 textArea.value = ''; |
161 document.execCommand('insertText', false, 'ABC'); | 161 document.execCommand('insertText', false, 'ABC'); |
162 shouldBe('textArea.value', '"ABC"'); | 162 shouldBe('textArea.value', '"ABC"'); |
163 </script> | 163 </script> |
164 <script src="../../fast/js/resources/js-test-post.js"></script> | 164 <script src="../../fast/js/resources/js-test-post.js"></script> |
165 </body> | 165 </body> |
166 </html> | 166 </html> |
OLD | NEW |