OLD | NEW |
1 <html> | |
2 <head> | 1 <head> |
| 2 <style> |
| 3 #sample { |
| 4 -webkit-user-select: none; |
| 5 user-select: none; |
| 6 } |
| 7 </style> |
| 8 </head> |
| 9 <body> |
| 10 <script src="../js/resources/js-test-pre.js"></script> |
| 11 <div id="container"> |
| 12 <p id="description"></p> |
| 13 Manual step |
| 14 <ol> |
| 15 <li>Click text input to focus it</li> |
| 16 <li>Hit Ctrl+A to select contents of text input</li> |
| 17 </ol> |
| 18 <input id="sample" value="foobar"> |
| 19 </div> |
3 <script> | 20 <script> |
4 function test() { | 21 description('Tests user-select:none doesn\'t affect select()'); |
5 if (window.testRunner) | 22 function $(id) { return document.getElementById(id); } |
6 testRunner.dumpAsText(); | 23 |
7 var tf = document.getElementById('tf'); | 24 var sample = $('sample'); |
8 tf.select(); | 25 sample.focus(); |
9 if (tf.selectionStart == 0 && tf.selectionEnd == 0) { // ; | 26 sample.select(); |
10 document.getElementById("result").innerHTML = "PASS"; | 27 shouldBe('sample.selectionStart', '0'); |
11 } else { | 28 shouldBe('sample.selectionEnd', 'sample.value.length'); |
12 document.getElementById("result").innerHTML = "FAIL: selection start is
" | 29 |
13 + tf.selectionStart + " and end is " + tf.selectionEnd + "."; | 30 if (window.testRunner) |
14 } | 31 $('container').outerHTML = ''; |
15 } | |
16 </script> | 32 </script> |
17 </head> | 33 <script src="../js/resources/js-test-post.js"></script> |
18 <body onload="test()"> | |
19 <p> | |
20 Tests behavior of select() in case "-webkit-user-select: none" | |
21 attribute is specified to the input element. The field should not be selected. | |
22 </p> | |
23 <p><input type="text" id="tf" value="input text" style="-webkit-user-select: non
e"></input></p> | |
24 <p id="result">TEST NOT RUN YET</p> | |
25 </body> | 34 </body> |
26 </html> | |
OLD | NEW |