<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Checks that KeyboardEvent.location is DOM_KEY_LOCATION_STANDARD for NumLock key.");
var lastKeyboardEvent = null;
function recordKeyEvent(ev) {
ev = ev || event;
ev.keyCode = (ev.which || ev.keyCode);
if (window.eventSender) {
lastKeyboardEvent = ev;
} else {
debug('Type=' + ev.type + ',' +
'keyCode=' + ev.keyCode + ',' +
'ctrlKey=' + ev.ctrlKey + ',' +
'shiftKey=' + ev.shiftKey + ',' +
'altKey=' + ev.altKey + ',' +
'metaKey=' + ev.metaKey + ',' +
'location=' + ev.location);
}
}
var textarea = document.createElement("textarea");
textarea.addEventListener("keydown", recordKeyEvent, false);
document.body.insertBefore(textarea, document.body.firstChild);
textarea.focus();
var VKEY_NUMLOCK = 0x90;
if (window.eventSender) {
eventSender.keyDown("NumLock");
shouldBeEqualToString("lastKeyboardEvent.type", "keydown");
shouldBe("lastKeyboardEvent.keyCode", "VKEY_NUMLOCK");
shouldBe("lastKeyboardEvent.location", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD");
} else {
debug("This test needs window.eventSender to run.");
}
</script>
</body>
</html>