blob: 25e09ff8e6ba0a74e55a695e00b736354c957eee [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" name="file" id="file">
<script>
description("This tests the events dispatched on user selection");
if (window.testRunner) {
jsTestIsAsync = true;
var inputDispatched = false;
var changeDispatched = false;
var file = document.getElementById("file");
file.addEventListener("input", function() {
debug("on input");
shouldBe("inputDispatched", "false");
shouldBe("changeDispatched", "false");
inputDispatched = true;
});
file.addEventListener("change", function() {
debug("on change");
shouldBe("inputDispatched", "true");
shouldBe("changeDispatched", "false");
changeDispatched = true;
finishJSTest();
});
openFilesInElement(file, ["foo.txt"]);
}
function openFilesInElement(input, files) {
testRunner.setOpenPanelFiles(files);
var centerX = input.offsetLeft + input.offsetWidth / 2;
var centerY = input.offsetTop + input.offsetHeight / 2;
UIHelper.activateAt(centerX, centerY);
}
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>