blob: 961e5e8ff78677c054657062ac68bd0b1141949b [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) {
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>