blob: e62352fbd9d2f9c25ecd5404d8b33aa6ff0c798f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../../resources/ui-helper.js"></script>
</head>
<body>
<input type="file" id="file" multiple onchange="onInputFileChange(this.files)">
<div id="description"></div>
<div id="console"></div>
<script>
description("Test the attribute of FileList.");
debug("Start");
function onInputFileChange(files)
{
window.files = files;
shouldBe("files.length", "2");
shouldBeTrue("files.item(0) instanceof File");
shouldBeEqualToString("files.item(0).name", "UTF8.txt");
shouldBeTrue("files.item(1) instanceof File");
shouldBeEqualToString("files.item(1).name", "UTF8-2.txt");
shouldBeNull("files.item(2)");
shouldBeNull("files.item(-1)");
shouldBeTrue("files.item(0) === files.item(4294967296)");
shouldBeTrue("files.item(1) === files.item(4294967297)");
shouldBeTrue("files.item(2) === files.item(4294967298)");
shouldBeTrue("files.item(-1) === files.item(4294967295)");
shouldBeTrue("files.item(-4294967295) === files.item(1)");
shouldBeTrue("files.item(-4294967296) === files.item(0)");
shouldBeTrue("files.item(null) === files.item(0)");
shouldBeTrue("files.item(undefined) === files.item(0)");
finishJSTest();
}
jsTestIsAsync = true;
testRunner.setOpenPanelFiles(["resources/UTF8.txt", "resources/UTF8-2.txt"]);
var inputElement = document.getElementById("file");
var centerX = inputElement.offsetLeft + inputElement.offsetWidth / 2;
var centerY = inputElement.offsetTop + inputElement.offsetHeight / 2;
UIHelper.activateAt(centerX, centerY);
</script>
</body>
<script src="../../resources/js-test-post.js"></script>
</html>