blob: cec9606a4f2fd619f9edec80669356e76f30f4dc [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=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>