| OLD | NEW |
| 1 description("This tests keyboard events with KeyLocationCode argument."); | 1 description("This tests keyboard events with KeyLocationCode argument."); |
| 2 | 2 |
| 3 var lastKeyboardEvent; | 3 var lastKeyboardEvent; |
| 4 | 4 |
| 5 function recordKeyEvent(ev) { | 5 function recordKeyEvent(ev) { |
| 6 ev = ev || event; | 6 ev = ev || event; |
| 7 ev.keyCode = (ev.which || ev.keyCode); | 7 ev.keyCode = (ev.which || ev.keyCode); |
| 8 if (window.eventSender) { | 8 if (window.eventSender) { |
| 9 lastKeyboardEvent = ev; | 9 lastKeyboardEvent = ev; |
| 10 } else { | 10 } else { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 shouldEvaluateTo("lastKeyboardEvent.keyCode", expectedKeyCode); | 24 shouldEvaluateTo("lastKeyboardEvent.keyCode", expectedKeyCode); |
| 25 shouldEvaluateTo("lastKeyboardEvent.location", evLocation); | 25 shouldEvaluateTo("lastKeyboardEvent.location", evLocation); |
| 26 } | 26 } |
| 27 | 27 |
| 28 var textarea = document.createElement("textarea"); | 28 var textarea = document.createElement("textarea"); |
| 29 textarea.addEventListener("keydown", recordKeyEvent, false); | 29 textarea.addEventListener("keydown", recordKeyEvent, false); |
| 30 document.body.insertBefore(textarea, document.body.firstChild); | 30 document.body.insertBefore(textarea, document.body.firstChild); |
| 31 textarea.focus(); | 31 textarea.focus(); |
| 32 | 32 |
| 33 if (window.eventSender) { | 33 if (window.eventSender) { |
| 34 testKeyEventWithLocation("pageUp", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"
, 33); | 34 testKeyEventWithLocation("PageUp", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"
, 33); |
| 35 testKeyEventWithLocation("pageDown", "KeyboardEvent.DOM_KEY_LOCATION_STANDAR
D", 34); | 35 testKeyEventWithLocation("PageDown", "KeyboardEvent.DOM_KEY_LOCATION_STANDAR
D", 34); |
| 36 testKeyEventWithLocation("home", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD",
36); | 36 testKeyEventWithLocation("Home", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD",
36); |
| 37 testKeyEventWithLocation("end", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 3
5); | 37 testKeyEventWithLocation("End", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD", 3
5); |
| 38 testKeyEventWithLocation("leftArrow", "KeyboardEvent.DOM_KEY_LOCATION_STANDA
RD", 37); | 38 testKeyEventWithLocation("ArrowLeft", "KeyboardEvent.DOM_KEY_LOCATION_STANDA
RD", 37); |
| 39 testKeyEventWithLocation("rightArrow", "KeyboardEvent.DOM_KEY_LOCATION_STAND
ARD", 39); | 39 testKeyEventWithLocation("ArrowRight", "KeyboardEvent.DOM_KEY_LOCATION_STAND
ARD", 39); |
| 40 testKeyEventWithLocation("upArrow", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD
", 38); | 40 testKeyEventWithLocation("ArrowUp", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD
", 38); |
| 41 testKeyEventWithLocation("downArrow", "KeyboardEvent.DOM_KEY_LOCATION_STANDA
RD", 40); | 41 testKeyEventWithLocation("ArrowDown", "KeyboardEvent.DOM_KEY_LOCATION_STANDA
RD", 40); |
| 42 testKeyEventWithLocation("insert", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"
, 45); | 42 testKeyEventWithLocation("Insert", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"
, 45); |
| 43 testKeyEventWithLocation("delete", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"
, 46); | 43 testKeyEventWithLocation("Delete", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"
, 46); |
| 44 | 44 |
| 45 testKeyEventWithLocation("pageUp", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD",
33); | 45 testKeyEventWithLocation("PageUp", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD",
33); |
| 46 testKeyEventWithLocation("pageDown", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD"
, 34); | 46 testKeyEventWithLocation("PageDown", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD"
, 34); |
| 47 testKeyEventWithLocation("home", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 36
); | 47 testKeyEventWithLocation("Home", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 36
); |
| 48 testKeyEventWithLocation("end", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 35)
; | 48 testKeyEventWithLocation("End", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD", 35)
; |
| 49 testKeyEventWithLocation("leftArrow", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD
", 37); | 49 testKeyEventWithLocation("ArrowLeft", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD
", 37); |
| 50 testKeyEventWithLocation("rightArrow", "KeyboardEvent.DOM_KEY_LOCATION_NUMPA
D", 39); | 50 testKeyEventWithLocation("ArrowRight", "KeyboardEvent.DOM_KEY_LOCATION_NUMPA
D", 39); |
| 51 testKeyEventWithLocation("upArrow", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD",
38); | 51 testKeyEventWithLocation("ArrowUp", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD",
38); |
| 52 testKeyEventWithLocation("downArrow", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD
", 40); | 52 testKeyEventWithLocation("ArrowDown", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD
", 40); |
| 53 testKeyEventWithLocation("insert", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD",
45); | 53 testKeyEventWithLocation("Insert", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD",
45); |
| 54 testKeyEventWithLocation("delete", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD",
46); | 54 testKeyEventWithLocation("Delete", "KeyboardEvent.DOM_KEY_LOCATION_NUMPAD",
46); |
| 55 } else { | 55 } else { |
| 56 debug("This test requires DumpRenderTree. To manually test, 1) focus on the
textarea above and push numpad keys without locking NumLock and 2) see if the l
ocation= value is KeyboardEvent.DOM_KEY_LOCATION_NUMPAD (specified in DOM level
3)."); | 56 debug("This test requires DumpRenderTree. To manually test, 1) focus on the
textarea above and push numpad keys without locking NumLock and 2) see if the l
ocation= value is KeyboardEvent.DOM_KEY_LOCATION_NUMPAD (specified in DOM level
3)."); |
| 57 } | 57 } |
| OLD | NEW |