| <div> |
| To test this manually, press mouse button below the '!' and drag the mouse to the comma between "Hello" and "world!". It's OK if "world!" is selected. |
| </div> |
| |
| <div id="result" style="width: 200px;"> |
| <span>Hello,</span><span id="world">world!</span><br><span style="padding-left: 200px; padding-bottom: 200px; background-color: blue; height: 200px;"></span> |
| </div> |
| |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| |
| var world = document.getElementById("world"); |
| var endX = world.offsetLeft; |
| var startX = endX + world.offsetWidth; |
| var endY = world.offsetTop; |
| var startY = endY + 50; |
| |
| eventSender.mouseMoveTo(startX, startY); |
| eventSender.mouseDown(); |
| eventSender.mouseMoveTo(startX, startY); |
| eventSender.mouseMoveTo(endX, endY); |
| eventSender.mouseUp(); |
| |
| var result = document.getElementById("result"); |
| if (window.getSelection() == "world!") { |
| result.style.backgroundColor = "green"; |
| result.innerHTML = "PASS"; |
| } else |
| result.innerHTML = "FAILED: the selection was " + window.getSelection(); |
| } |
| </script> |