|
Line 0
a/LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher.html_sec1
|
|
|
1 |
<html> |
| 2 |
<body> |
| 3 |
<script> |
| 4 |
function debug(msg) { |
| 5 |
var console = document.getElementById('console'); |
| 6 |
var line = document.createElement('div'); |
| 7 |
line.textContent = msg; |
| 8 |
console.appendChild(line); |
| 9 |
} |
| 10 |
|
| 11 |
function editingTest() { |
| 12 |
if (!window.testRunner) |
| 13 |
return; |
| 14 |
|
| 15 |
testRunner.dumpAsText(); |
| 16 |
testRunner.waitUntilDone(); |
| 17 |
|
| 18 |
// Drag text in the source |
| 19 |
var sel = window.getSelection(); |
| 20 |
var range = document.createRange(); |
| 21 |
range.setStartBefore(document.getElementById("source")); |
| 22 |
range.setEndBefore(document.getElementById("destination")); |
| 23 |
sel.removeAllRanges(); |
| 24 |
sel.addRange(range); |
| 25 |
|
| 26 |
x = source.offsetLeft + 10; |
| 27 |
y = source.offsetTop + source.offsetHeight / 2; |
| 28 |
eventSender.mouseMoveTo(x, y); |
| 29 |
eventSender.mouseDown(); |
| 30 |
// and drop it off to the destination field. |
| 31 |
var destination = document.getElementById("destination"); |
| 32 |
eventSender.leapForward(500); |
| 33 |
eventSender.mouseMoveTo(destination.offsetLeft + 10, destination.offsetTop + destination.offsetHeight / 2); |
| 34 |
eventSender.mouseUp(); |
| 35 |
|
| 36 |
var result = destination.value; |
| 37 |
debug("Pass"); |
| 38 |
|
| 39 |
testRunner.notifyDone(); |
| 40 |
} |
| 41 |
</script> |
| 42 |
<p>This tests text selection drag including a <p> tag, where its parent <p> tag is not editable.</p> |
| 43 |
To test this by hand, select the relevant text in this editable span: |
| 44 |
<p> |
| 45 |
<span id=source>Select |
| 46 |
<p>me</p> |
| 47 |
<p id=destination contenteditable>and drag it here</p> |
| 48 |
</span> |
| 49 |
</p> |
| 50 |
<br><br>If there is no crash, then the test passed. |
| 51 |
<div id=console></div> |
| 52 |
<script>editingTest();</script> |
| 53 |
</body> |
| 54 |
</html> |