blob: e5982059d1be0dc7746dc0c017a86993ffc364f5 [file] [log] [blame]
<html>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<div>This test checks that the plain text dropped into a styled text region will acquire the appropriate style.</div>
<p>To run this test manually, drag the text in the input element below into the bold text region. The dropped text should be bold.
Click the verify button to check.</p>
<input type="button" value="Verify" onClick="verifier()">
<br />
<input id="grabme" value="Drag this text" >
<br />
<b contenteditable="true" id="destination">Drag the text from the above input element into this bold text</b>
<ul id="console"></ul>
<script>
function log(message) {
var console = document.getElementById("console");
var li = document.createElement("li");
var pre = document.createElement("pre");
pre.appendChild(document.createTextNode(message));
li.appendChild(pre);
console.appendChild(li);
}
function runTest() {
var textToDrag = document.getElementById("grabme");
textToDrag.focus();
if (!window.testRunner)
return;
var x = textToDrag.offsetLeft + textToDrag.offsetWidth / 2;
var y = textToDrag.offsetTop + textToDrag.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
// Wait a moment so that the mouseDown will kick off a drag
eventSender.leapForward(400);
var destinationObject = document.getElementById("destination");
var x = destinationObject.offsetLeft + destinationObject.offsetWidth / 2;
var y = destinationObject.offsetTop + destinationObject.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseUp();
verifier();
}
function verifier() {
log(document.getElementById("destination").outerHTML);
if (document.getElementById("destination").childNodes.length == 1)
log("SUCCESS");
else
log("FAILURE");
}
runTest();
</script>
</html>