4 <script src=
"../../resources/js-test.js"></script>
8 description("Checks that KeyboardEvent.location is DOM_KEY_LOCATION_STANDARD for NumLock key.");
10 var lastKeyboardEvent
= null;
11 function recordKeyEvent(ev
) {
13 ev
.keyCode
= (ev
.which
|| ev
.keyCode
);
14 if (window
.eventSender
) {
15 lastKeyboardEvent
= ev
;
17 debug('Type=' + ev
.type
+ ',' +
18 'keyCode=' + ev
.keyCode
+ ',' +
19 'ctrlKey=' + ev
.ctrlKey
+ ',' +
20 'shiftKey=' + ev
.shiftKey
+ ',' +
21 'altKey=' + ev
.altKey
+ ',' +
22 'metaKey=' + ev
.metaKey
+ ',' +
23 'location=' + ev
.location
);
27 var textarea
= document
.createElement("textarea");
28 textarea
.addEventListener("keydown", recordKeyEvent
, false);
29 document
.body
.insertBefore(textarea
, document
.body
.firstChild
);
32 var VKEY_NUMLOCK
= 0x90;
34 if (window
.eventSender
) {
35 eventSender
.keyDown("numLock");
36 shouldBeEqualToString("lastKeyboardEvent.type", "keydown");
37 shouldBe("lastKeyboardEvent.keyCode", "VKEY_NUMLOCK");
38 shouldBe("lastKeyboardEvent.location", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD");
40 debug("This test needs window.eventSender to run.");