Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: LayoutTests/fast/events/keyboardevent-code.html

Issue 663523002: Adding support for DOM3 KeyboardEvents Code in KeyboardEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added keyboardTest failure for virtual/slimmingpaint Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/events/keyboardevent-code-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardE vent-code" />
3 <script src="../../resources/js-test.js"></script>-
4 <textarea id="textarea"></textarea>
5 <script>
6 description('Tests KeyboardEvent.code attribute');
7 var textarea = document.getElementById('textarea');
8 textarea.addEventListener('keydown', recordKeyEvent, false);
9 textarea.addEventListener('keyup', recordKeyEvent, false);
10 textarea.addEventListener('keypress', recordKeyEvent, false);
11 textarea.focus();
12
13 var lastKeyboardDownEvent, lastKeyboardPressEvent, lastKeyboardUpEvent;
14
15 function recordKeyEvent(ev) {
16 if (window.eventSender) {
17 if (ev.type === "keydown")
18 lastKeyboardDownEvent = ev;
19 else if (ev.type === "keyup")
20 lastKeyboardUpEvent = ev;
21 else if (ev.type === "keypress")
22 lastKeyboardPressEvent = ev;
23 } else {
24 debug('Type=' + ev.type + ',' + 'code=' + ev.code);
25 }
26 }
27
28 if (window.eventSender) {
29 debug('AlphaNumeric Keys');
30 eventSender.keyDown('A');
31 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyA\'') ;
32 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'KeyA\'') ;
33 shouldEvaluateTo('lastKeyboardPressEvent.code', '\'KeyA\'') ;
34 eventSender.keyDown('a'); // Small letters.
35 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyA\'') ;
36 eventSender.keyDown('M');
37 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyM\'') ;
38 eventSender.keyDown('m'); // Small letters.
39 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyM\'');
40 eventSender.keyDown('Z');
41 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyZ\'') ;
42 eventSender.keyDown('z');
43 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyZ\'');
44 eventSender.keyDown('0');
45 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Digit0\'');
46 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Digit0\'');
47 shouldEvaluateTo('lastKeyboardPressEvent.code', '\'Digit0\'');
48 eventSender.keyDown('4');
49 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Digit4\'');
50 eventSender.keyDown('9');
51 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Digit9\'');
52 eventSender.keyDown('backspace');
53 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Backspace\'');
54
55 debug('Functional Keys');
56 eventSender.keyDown('leftControl');
57 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ControlLeft\'');
58 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'ControlLeft\'');
59 eventSender.keyDown('rightControl');
60 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ControlRight\'');
61 eventSender.keyDown('leftShift');
62 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ShiftLeft\'');
63 eventSender.keyDown('rightShift');
64 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ShiftRight\'');
65 eventSender.keyDown('leftAlt');
66 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'AltLeft\'');
67 eventSender.keyDown('rightAlt');
68 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'AltRight\'');
69 eventSender.keyDown('\n');
70 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Enter\'');
71 eventSender.keyDown('menu');
72 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ContextMenu\'');
73 eventSender.keyDown(' ');
74 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Space\'');
75 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Space\'');
76 shouldEvaluateTo('lastKeyboardPressEvent.code', '\'Space\'');
77 eventSender.keyDown('\t');
78 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Tab\'');
79 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Tab\'');
80
81 debug('Control Pad');
82 eventSender.keyDown('insert');
83 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Insert\'');
84 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Insert\'');
85 eventSender.keyDown('delete');
86 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Delete\'');
87 eventSender.keyDown('home');
88 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Home\'');
89 eventSender.keyDown('end');
90 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'End\'');
91 eventSender.keyDown('pageUp');
92 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'PageUp\'');
93 eventSender.keyDown('pageDown');
94 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'PageDown\'');
95 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'PageDown\'');
96
97 debug('Arrow Pad Section');
98 eventSender.keyDown('rightArrow');
99 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ArrowRight\'');
100 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'ArrowRight\'');
101 eventSender.keyDown('downArrow');
102 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ArrowDown\'');
103 eventSender.keyDown('leftArrow');
104 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ArrowLeft\'');
105 eventSender.keyDown('upArrow');
106 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ArrowUp\'');
107 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'ArrowUp\'');
108
109 debug('Number Pad Section');
110 eventSender.keyDown('numLock');
111 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'NumLock\'');
112 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'NumLock\'');
113
114 debug('Function Section');
115 eventSender.keyDown('escape');
116 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Escape\'');
117 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Escape\'');
118 eventSender.keyDown('F1');
119 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'F1\'');
120 eventSender.keyDown('F6');
121 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'F6\'');
122 eventSender.keyDown('F12');
123 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'F12\'');
124 eventSender.keyDown('printScreen');
125 shouldEvaluateTo('lastKeyboardDownEvent.code', '\'PrintScreen\'');
126 shouldEvaluateTo('lastKeyboardUpEvent.code', '\'PrintScreen\'');
127 }
128 </script>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/events/keyboardevent-code-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698