| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <title>Test of text field setSelectionRange</title> | 2 <title>Test of text field setSelectionRange</title> |
| 3 <link rel="author" title="Takeharu.Oshida" href="mailto:georgeosddev@gmail.com"> | 3 <link rel="author" title="Takeharu.Oshida" href="mailto:georgeosddev@gmail.com"> |
| 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-textarea/inpu
t-setselectionrange"> | 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-textarea/inpu
t-setselectionrange"> |
| 5 <script src="../../../../../../resources/testharness.js"></script> | 5 <script src="../../../../../../resources/testharness.js"></script> |
| 6 <script src="../../../../../../resources/testharnessreport.js"></script> | 6 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 7 <div id="log"></div> | 7 <div id="log"></div> |
| 8 <div id="hide" style="display: block"> | 8 <div id="hide" style="display: block"> |
| 9 <input id="a" type="text" value="abcde"> | 9 <input id="a" type="text" value="abcde"> |
| 10 <textarea id="b">abcde</textarea> | 10 <textarea id="b">abcde</textarea> |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 assert_equals(textarea.selectionDirection, "none", "selectionDirection shoul
d be 'none'"); | 174 assert_equals(textarea.selectionDirection, "none", "selectionDirection shoul
d be 'none'"); |
| 175 },'textarea direction of setSelectionRange(0,1,"BACKWARD")'); | 175 },'textarea direction of setSelectionRange(0,1,"BACKWARD")'); |
| 176 | 176 |
| 177 test(function() { | 177 test(function() { |
| 178 textarea.setSelectionRange(0,1) | 178 textarea.setSelectionRange(0,1) |
| 179 assert_equals(textarea.selectionDirection, "none", "if the argument is omitt
ed"); | 179 assert_equals(textarea.selectionDirection, "none", "if the argument is omitt
ed"); |
| 180 },'textarea direction of setSelectionRange(0,1)'); | 180 },'textarea direction of setSelectionRange(0,1)'); |
| 181 | 181 |
| 182 test(function() { | 182 test(function() { |
| 183 textarea.setSelectionRange("string",1); | 183 textarea.setSelectionRange("string",1); |
| 184 assert_equals(textarea.selectionStart, 1, "element.selectionStart should be
0"); | 184 assert_equals(textarea.selectionStart, 0, "element.selectionStart should be
0"); |
| 185 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); | 185 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); |
| 186 },'textarea setSelectionRange("string",1)'); | 186 },'textarea setSelectionRange("string",1)'); |
| 187 | 187 |
| 188 test(function() { | 188 test(function() { |
| 189 textarea.setSelectionRange(true,1); | 189 textarea.setSelectionRange(true,1); |
| 190 assert_equals(textarea.selectionStart, 1, "element.selectionStart should be
1"); | 190 assert_equals(textarea.selectionStart, 1, "element.selectionStart should be
1"); |
| 191 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); | 191 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); |
| 192 },'textarea setSelectionRange(true,1)'); | 192 },'textarea setSelectionRange(true,1)'); |
| 193 | 193 |
| 194 test(function() { | 194 test(function() { |
| 195 textarea.setSelectionRange([],1); | 195 textarea.setSelectionRange([],1); |
| 196 assert_equals(textarea.selectionStart, 1, "element.selectionStart should be
0"); | 196 assert_equals(textarea.selectionStart, 0, "element.selectionStart should be
0"); |
| 197 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); | 197 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); |
| 198 },'textarea setSelectionRange([],1)'); | 198 },'textarea setSelectionRange([],1)'); |
| 199 | 199 |
| 200 test(function() { | 200 test(function() { |
| 201 textarea.setSelectionRange({},1); | 201 textarea.setSelectionRange({},1); |
| 202 assert_equals(textarea.selectionStart, 1, "element.selectionStart should be
0"); | 202 assert_equals(textarea.selectionStart, 0, "element.selectionStart should be
0"); |
| 203 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); | 203 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); |
| 204 },'textarea setSelectionRange({},1)'); | 204 },'textarea setSelectionRange({},1)'); |
| 205 | 205 |
| 206 test(function() { | 206 test(function() { |
| 207 textarea.setSelectionRange(NaN,1); | 207 textarea.setSelectionRange(NaN,1); |
| 208 assert_equals(textarea.selectionStart, 1, "element.selectionStart should be
0"); | 208 assert_equals(textarea.selectionStart, 0, "element.selectionStart should be
0"); |
| 209 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); | 209 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); |
| 210 },'textarea setSelectionRange(NaN,1)'); | 210 },'textarea setSelectionRange(NaN,1)'); |
| 211 | 211 |
| 212 test(function() { | 212 test(function() { |
| 213 textarea.setSelectionRange(null,1); | 213 textarea.setSelectionRange(null,1); |
| 214 assert_equals(textarea.selectionStart, 1, "element.selectionStart should be
0"); | 214 assert_equals(textarea.selectionStart, 0, "element.selectionStart should be
0"); |
| 215 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); | 215 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); |
| 216 },'textarea setSelectionRange(null,1)'); | 216 },'textarea setSelectionRange(null,1)'); |
| 217 | 217 |
| 218 test(function() { | 218 test(function() { |
| 219 textarea.setSelectionRange(undefined,1); | 219 textarea.setSelectionRange(undefined,1); |
| 220 assert_equals(textarea.selectionStart, 1, "element.selectionStart should be
0"); | 220 assert_equals(textarea.selectionStart, 0, "element.selectionStart should be
0"); |
| 221 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); | 221 assert_equals(textarea.selectionEnd, 1, "element.selectionStart should be 1"
); |
| 222 },'textarea setSelectionRange(undefined,1)'); | 222 },'textarea setSelectionRange(undefined,1)'); |
| 223 },"test of textarea.setSelectionRange"); | 223 },"test of textarea.setSelectionRange"); |
| 224 </script> | 224 </script> |
| OLD | NEW |