blob: 61cb2c891adeff0426d741771b7ab0c5c6163763 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body oncopy="copy(event)" onpaste="paste(event)">
<div id="text">This file tests if text selection is causing oncopy event to get fired. This test requires DRT.</div>
<div id="console"></div>
<script src="../editing.js"></script>
<script>
var oncopyCounter = 0;
function log(text)
{
var console = document.getElementById('console');
console.appendChild(document.createTextNode(text));
console.appendChild(document.createElement('br'));
}
function copy(ev)
{
++oncopyCounter;
}
function runTest() {
if (!window.testRunner)
return;
testRunner.dumpAsText();
log("Selecting text with mouse, no copy events should occur:");
log("Event count: " + oncopyCounter)
var text = document.getElementById("text")
eventSender.mouseMoveTo(text.offsetLeft, text.offsetTop);
eventSender.mouseDown();
eventSender.mouseMoveTo(text.offsetLeft + text.offsetWidth, text.offsetTop);
eventSender.mouseUp();
log("Copying text, 1 copy event should occur:");
copyCommand();
log("Event count: " + oncopyCounter);
}
runTest();
</script>
</body>
</html>