| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <body> | 2 <body> |
| 3 <script> | 3 <script> |
| 4 function debug(msg) { | 4 function debug(msg) { |
| 5 var console = document.getElementById('console'); | 5 var console = document.getElementById('console'); |
| 6 var line = document.createElement('div'); | 6 var line = document.createElement('div'); |
| 7 line.textContent = msg; | 7 line.textContent = msg; |
| 8 console.appendChild(line); | 8 console.appendChild(line); |
| 9 } | 9 } |
| 10 | 10 |
| 11 function editingTest() { | 11 function editingTest() { |
| 12 if (!window.testRunner) | 12 if (!window.testRunner) |
| 13 return; | 13 return; |
| 14 | 14 |
| 15 testRunner.dumpAsText(); | 15 testRunner.dumpAsText(); |
| 16 testRunner.waitUntilDone(); | 16 testRunner.waitUntilDone(); |
| 17 | 17 |
| 18 // Drag a URL text in the source | 18 // Drag a URL text in the source |
| 19 var source = document.getElementById("source"); | 19 var source = document.getElementById("source"); |
| 20 source.focus(); |
| 20 source.setSelectionRange(0, source.value.length); | 21 source.setSelectionRange(0, source.value.length); |
| 21 x = source.offsetLeft + 10; | 22 x = source.offsetLeft + 10; |
| 22 y = source.offsetTop + source.offsetHeight / 2; | 23 y = source.offsetTop + source.offsetHeight / 2; |
| 23 eventSender.mouseMoveTo(x, y); | 24 eventSender.mouseMoveTo(x, y); |
| 24 eventSender.mouseDown(); | 25 eventSender.mouseDown(); |
| 25 // and drop it off to the destination field. | 26 // and drop it off to the destination field. |
| 26 var destination = document.getElementById("destination"); | 27 var destination = document.getElementById("destination"); |
| 27 eventSender.leapForward(500); | 28 eventSender.leapForward(500); |
| 28 eventSender.mouseMoveTo(destination.offsetLeft + 10, destination.offsetTop +
destination.offsetHeight / 2); | 29 eventSender.mouseMoveTo(destination.offsetLeft + 10, destination.offsetTop +
destination.offsetHeight / 2); |
| 29 eventSender.mouseUp(); | 30 eventSender.mouseUp(); |
| 30 | 31 |
| 31 var result = destination.value; | 32 var result = destination.value; |
| 32 debug(result == 'http://www.apple.com/' ? 'PASS' : 'FAIL: expected value="ht
tp://www.apple.com/", actual value="' + result + '"'); | 33 debug(result == 'http://www.apple.com/' ? 'PASS' : 'FAIL: expected value="ht
tp://www.apple.com/", actual value="' + result + '"'); |
| 33 | 34 |
| 34 testRunner.notifyDone(); | 35 testRunner.notifyDone(); |
| 35 } | 36 } |
| 36 </script> | 37 </script> |
| 37 <p>This tests text selection drag for a URL-like text.</p> | 38 <p>This tests text selection drag for a URL-like text.</p> |
| 38 To test this by hand, select all of the text in this input: <input id=source val
ue="http://www.apple.com/"><br> | 39 To test this by hand, select all of the text in this input: <input id=source val
ue="http://www.apple.com/"><br> |
| 39 and drag/drop it into this input: <input id=destination> | 40 and drag/drop it into this input: <input id=destination> |
| 40 <br><br>If you see that the text "http://www.apple.com/" was put in the second b
ox, then the test passed. | 41 <br><br>If you see that the text "http://www.apple.com/" was put in the second b
ox, then the test passed. |
| 41 <div id=console></div> | 42 <div id=console></div> |
| 42 <script>editingTest();</script> | 43 <script>editingTest();</script> |
| 43 </body> | 44 </body> |
| 44 </html> | 45 </html> |
| OLD | NEW |