Commit 00240809 authored by pam@chromium.org's avatar pam@chromium.org

2008-12-08 Pamela Greene <pam@chromium.org>

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=22739
        Test the sequence of keyboard events generated for a keypress.

        * fast/events/special-key-events-in-input-text-expected.txt: Added.
        * fast/events/special-key-events-in-input-text.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39110 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 65eae60d
2008-12-08 Pamela Greene <pam@chromium.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=22739
Test the sequence of keyboard events generated for a keypress.
* fast/events/special-key-events-in-input-text-expected.txt: Added.
* fast/events/special-key-events-in-input-text.html: Added.
2008-12-08 Julien Chaffraix <jchaffraix@webkit.org>
Reviewed by Darin Adler.
......
To test manually, press keys and compare results to other browsers.
target - type - ctrlKey,altKey,shiftKey,metaKey - keyIdentifier - keyCode - charCode
Ampersand:
INPUT - keydown - false,false,true,false - U+0037 - 55 - 0. Value: "".
INPUT - keypress - false,false,true,false - - 55 - 55. Value: "".
INPUT - textInput - 7. Value: "".
INPUT - keyup - false,false,true,false - U+0037 - 55 - 0. Value: "7".
Backspace:
INPUT - keydown - false,false,false,false - U+0008 - 8 - 0. Value: "7".
INPUT - keyup - false,false,false,false - U+0008 - 8 - 0. Value: "".
Percent:
INPUT - keydown - false,false,true,false - U+0035 - 53 - 0. Value: "".
INPUT - keypress - false,false,true,false - - 53 - 53. Value: "".
INPUT - textInput - 5. Value: "".
INPUT - keyup - false,false,true,false - U+0035 - 53 - 0. Value: "5".
Backspace:
INPUT - keydown - false,false,false,false - U+0008 - 8 - 0. Value: "5".
INPUT - keyup - false,false,false,false - U+0008 - 8 - 0. Value: "".
Left parentheses:
INPUT - keydown - false,false,true,false - U+0039 - 57 - 0. Value: "".
INPUT - keypress - false,false,true,false - - 57 - 57. Value: "".
INPUT - textInput - 9. Value: "".
INPUT - keyup - false,false,true,false - U+0039 - 57 - 0. Value: "9".
Backspace:
INPUT - keydown - false,false,false,false - U+0008 - 8 - 0. Value: "9".
INPUT - keyup - false,false,false,false - U+0008 - 8 - 0. Value: "".
Right parentheses:
INPUT - keydown - false,false,true,false - U+0030 - 48 - 0. Value: "".
INPUT - keypress - false,false,true,false - - 48 - 48. Value: "".
INPUT - textInput - 0. Value: "".
INPUT - keyup - false,false,true,false - U+0030 - 48 - 0. Value: "0".
Backspace:
INPUT - keydown - false,false,false,false - U+0008 - 8 - 0. Value: "0".
INPUT - keyup - false,false,false,false - U+0008 - 8 - 0. Value: "".
Left Curly Brace:
INPUT - keydown - false,false,true,false - U+00DB - 0 - 0. Value: "".
INPUT - keypress - false,false,true,false - - 219 - 219. Value: "".
INPUT - textInput - Û. Value: "".
INPUT - keyup - false,false,true,false - U+00DB - 0 - 0. Value: "Û".
Backspace:
INPUT - keydown - false,false,false,false - U+0008 - 8 - 0. Value: "Û".
INPUT - keyup - false,false,false,false - U+0008 - 8 - 0. Value: "".
Right Curly Brace:
INPUT - keydown - false,false,true,false - U+00DD - 0 - 0. Value: "".
INPUT - keypress - false,false,true,false - - 221 - 221. Value: "".
INPUT - textInput - Ý. Value: "".
INPUT - keyup - false,false,true,false - U+00DD - 0 - 0. Value: "Ý".
Backspace:
INPUT - keydown - false,false,false,false - U+0008 - 8 - 0. Value: "Ý".
INPUT - keyup - false,false,false,false - U+0008 - 8 - 0. Value: "".
<html><head></head>
<body>
<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>
<input type="text"></input>
<div id="log"></div>
<script>
function log(msg) {
document.getElementById("log").innerHTML+= msg + "<br>";
}
function logEvent(e) {
var target = e.target;
var type = e.type;
var info = target.tagName + " - " + type + ' - ';
if (type == "textInput") {
info += e.data;
} else if (type == "keydown" || type == "keypress" || type == "keyup") {
info += [e.ctrlKey, e.altKey, e.shiftKey, e.metaKey] +
' - ' + e.keyIdentifier +
' - ' + e.keyCode +
' - ' + e.charCode;
}
info += '. Value: "' + target.value + '".';
log(info);
}
log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
+ ' - ' + "keyIdentifier"
+ ' - ' + "keyCode"
+ ' - ' + "charCode");
var input = document.getElementsByTagName("input")[0];
input.addEventListener('textInput', logEvent, false);
input.addEventListener('keypress', logEvent, false);
input.addEventListener('keydown', logEvent, false);
input.addEventListener('keyup', logEvent, false);
input.focus();
if (window.layoutTestController) {
layoutTestController.dumpAsText();
log("<br>Ampersand:");
eventSender.keyDown("7", ["shiftKey"]);
log("<br>Backspace:");
eventSender.keyDown("\x08", []);
log("<br>Percent:");
eventSender.keyDown("5", ["shiftKey"]);
log("<br>Backspace:");
eventSender.keyDown("\x08", []);
log("<br>Left parenthesis:");
eventSender.keyDown("9", ["shiftKey"]);
log("<br>Backspace:");
eventSender.keyDown("\x08", []);
log("<br>Right parenthesis:");
eventSender.keyDown("0", ["shiftKey"]);
log("<br>Backspace:");
eventSender.keyDown("\x08", []);
}
</script>
</body></html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment