3 <p>This test verifies that the correct sequence of keyboard events is generated for a keypress for certain special keys. To test manually, press keys and compare results to other browsers.
</p>
4 <input type=
"text"></input>
9 document
.getElementById("log").innerHTML
+= msg
+ "<br>";
12 function logEvent(e
) {
13 var target
= e
.target
;
16 var info
= target
.tagName
+ " - " + type
+ ' - ';
17 if (type
== "textInput") {
19 } else if (type
== "keydown" || type
== "keypress" || type
== "keyup") {
20 info
+= [e
.ctrlKey
, e
.altKey
, e
.shiftKey
, e
.metaKey
] +
21 ' - ' + e
.keyIdentifier
+
25 info
+= '. Value: "' + target
.value
+ '".';
29 log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
30 + ' - ' + "keyIdentifier"
32 + ' - ' + "charCode");
34 var input
= document
.getElementsByTagName("input")[0];
35 input
.addEventListener('textInput', logEvent
, false);
36 input
.addEventListener('keypress', logEvent
, false);
37 input
.addEventListener('keydown', logEvent
, false);
38 input
.addEventListener('keyup', logEvent
, false);
41 if (window
.testRunner
) {
42 testRunner
.dumpAsText();
43 log("<br>Ampersand:");
44 eventSender
.keyDown("7", ["shiftKey"]);
45 log("<br>Backspace:");
46 eventSender
.keyDown("backspace", []);
48 eventSender
.keyDown("5", ["shiftKey"]);
49 log("<br>Backspace:");
50 eventSender
.keyDown("backspace", []);
51 log("<br>Left parenthesis:");
52 eventSender
.keyDown("9", ["shiftKey"]);
53 log("<br>Backspace:");
54 eventSender
.keyDown("backspace", []);
55 log("<br>Right parenthesis:");
56 eventSender
.keyDown("0", ["shiftKey"]);
57 log("<br>Backspace:");
58 eventSender
.keyDown("backspace", []);
59 log("<br>Print screen:");
60 eventSender
.keyDown("printScreen", []);