blob: 72ab1993d5318163633c41f21cff8abd877c9e76 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<input type="file" ondrop="dropped(event)"></input>
<div id="console"></div>
<script>
description("Tests that FileList objects have an iterator.");
jsTestIsAsync = true;
function runTest()
{
var inputElement = document.getElementsByTagName('input')[0];
eventSender.beginDragWithFiles(['test.txt']);
eventSender.mouseMoveTo(inputElement.offsetLeft + inputElement.offsetWidth / 2,
inputElement.offsetTop + inputElement.offsetHeight / 2);
eventSender.mouseUp();
}
function dropped(event)
{
fileList = event.dataTransfer.files;
shouldBe("fileList.__proto__", "FileList.prototype");
shouldBeTrue("Symbol.iterator in fileList");
forOfSucceeded = false;
try {
for (var file of fileList) { }
forOfSucceeded = true;
} catch (e) {
forOfSucceeded = false;
}
shouldBeTrue("forOfSucceeded");
shouldBeFalse("'entries' in fileList");
shouldBeFalse("'keys' in fileList");
shouldBeFalse("'forEach' in fileList");
shouldBeFalse("'values' in fileList");
finishJSTest();
}
runTest();
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>