blob: fc0af43726247a576d53a26e9fd7a79ca268b58d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
function log(text) {
var log = document.getElementById('log');
log.appendChild(document.createTextNode(text));
log.appendChild(document.createElement('br'));
}
function dragStartTest(e) {
if (e.__proto__ == DragEvent.prototype)
log('PASS: event is a DragEvent');
else
log('FAIL: event is not a DragEvent');
e.dataTransfer.setData('text/plain', 'dragstart test');
if (event.dataTransfer.types.indexOf('text/plain') < 0 ||
event.dataTransfer.getData('text/plain') != 'dragstart test')
log('dragstart: FAILED');
else
log('dragstart: SUCCESS');
}
function runTest() {
if (!window.testRunner)
return;
testRunner.dumpAsText();
var draggedElement = document.getElementById('draggedElement');
var x = draggedElement.offsetLeft + draggedElement.offsetWidth / 2;
var y = draggedElement.offsetTop + draggedElement.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.leapForward(100);
eventSender.mouseMoveTo(x + 100, y + 100);
eventSender.mouseUp();
}
</script>
</head>
<body onload="runTest()">
<p>Simple test that data set during a dragstart event can be read back. To run
the test manually, simply start dragging the 'Drag Me' element below.
<div id="draggedElement" draggable="true" ondragstart="dragStartTest(event)">Drag Me</div>
<div id="log"></div>
</html>