blob: b3c585693c75ad59608922eb85cd363964fdb56d [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ AttachmentElementEnabled=true ] -->
<html>
<body>
<p id="description"></p>
<div id="console"></div>
<div id="editable" contentEditable=true style="width:200px; height:200px"></div>
<script src="../../resources/js-test-pre.js"></script>
<script>
description('If we drag files onto an editable area, then attachments should be inserted into the editable area.');
var editable = document.getElementById("editable");
if (window.eventSender) {
dragFilesOntoEditable(['foo', 'bar', 'baz']);
var resultChildren = editable.children;
var fileNames = "";
for (var i = 0; i < resultChildren.length; i++) {
var attachment = resultChildren[i];
shouldBeEqualToString('attachment.nodeName', 'ATTACHMENT');
fileNames += attachment.file.name + " ";
}
shouldBeEqualToString('fileNames', 'foo bar baz ');
editable.innerHTML = '';
}
function moveMouseToCenterOfElement(element)
{
var centerX = element.offsetLeft + element.offsetWidth / 2;
var centerY = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(centerX, centerY);
}
function dragFilesOntoEditable(files)
{
eventSender.beginDragWithFiles(files);
moveMouseToCenterOfElement(editable);
eventSender.mouseUp();
}
var successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>