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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/events/keyboardevent-code-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/keyboardevent-code.html
diff --git a/LayoutTests/fast/events/keyboardevent-code.html b/LayoutTests/fast/events/keyboardevent-code.html
new file mode 100644
index 0000000000000000000000000000000000000000..a2066b529ab1b2118c1ebd6e9f7e3247f6f07459
--- /dev/null
+++ b/LayoutTests/fast/events/keyboardevent-code.html
@@ -0,0 +1,128 @@
+<!DOCTYPE html>
+<link rel="help" href="http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent-code" />
+<script src="../../resources/js-test.js"></script>-
+<textarea id="textarea"></textarea>
+<script>
+description('Tests KeyboardEvent.code attribute');
+var textarea = document.getElementById('textarea');
+textarea.addEventListener('keydown', recordKeyEvent, false);
+textarea.addEventListener('keyup', recordKeyEvent, false);
+textarea.addEventListener('keypress', recordKeyEvent, false);
+textarea.focus();
+
+var lastKeyboardDownEvent, lastKeyboardPressEvent, lastKeyboardUpEvent;
+
+function recordKeyEvent(ev) {
+ if (window.eventSender) {
+ if (ev.type === "keydown")
+ lastKeyboardDownEvent = ev;
+ else if (ev.type === "keyup")
+ lastKeyboardUpEvent = ev;
+ else if (ev.type === "keypress")
+ lastKeyboardPressEvent = ev;
+ } else {
+ debug('Type=' + ev.type + ',' + 'code=' + ev.code);
+ }
+}
+
+if (window.eventSender) {
+ debug('AlphaNumeric Keys');
+ eventSender.keyDown('A');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyA\'') ;
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'KeyA\'') ;
+ shouldEvaluateTo('lastKeyboardPressEvent.code', '\'KeyA\'') ;
+ eventSender.keyDown('a'); // Small letters.
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyA\'') ;
+ eventSender.keyDown('M');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyM\'') ;
+ eventSender.keyDown('m'); // Small letters.
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyM\'');
+ eventSender.keyDown('Z');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyZ\'') ;
+ eventSender.keyDown('z');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'KeyZ\'');
+ eventSender.keyDown('0');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Digit0\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Digit0\'');
+ shouldEvaluateTo('lastKeyboardPressEvent.code', '\'Digit0\'');
+ eventSender.keyDown('4');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Digit4\'');
+ eventSender.keyDown('9');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Digit9\'');
+ eventSender.keyDown('backspace');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Backspace\'');
+
+ debug('Functional Keys');
+ eventSender.keyDown('leftControl');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ControlLeft\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'ControlLeft\'');
+ eventSender.keyDown('rightControl');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ControlRight\'');
+ eventSender.keyDown('leftShift');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ShiftLeft\'');
+ eventSender.keyDown('rightShift');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ShiftRight\'');
+ eventSender.keyDown('leftAlt');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'AltLeft\'');
+ eventSender.keyDown('rightAlt');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'AltRight\'');
+ eventSender.keyDown('\n');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Enter\'');
+ eventSender.keyDown('menu');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ContextMenu\'');
+ eventSender.keyDown(' ');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Space\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Space\'');
+ shouldEvaluateTo('lastKeyboardPressEvent.code', '\'Space\'');
+ eventSender.keyDown('\t');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Tab\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Tab\'');
+
+ debug('Control Pad');
+ eventSender.keyDown('insert');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Insert\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Insert\'');
+ eventSender.keyDown('delete');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Delete\'');
+ eventSender.keyDown('home');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Home\'');
+ eventSender.keyDown('end');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'End\'');
+ eventSender.keyDown('pageUp');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'PageUp\'');
+ eventSender.keyDown('pageDown');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'PageDown\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'PageDown\'');
+
+ debug('Arrow Pad Section');
+ eventSender.keyDown('rightArrow');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ArrowRight\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'ArrowRight\'');
+ eventSender.keyDown('downArrow');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ArrowDown\'');
+ eventSender.keyDown('leftArrow');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ArrowLeft\'');
+ eventSender.keyDown('upArrow');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'ArrowUp\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'ArrowUp\'');
+
+ debug('Number Pad Section');
+ eventSender.keyDown('numLock');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'NumLock\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'NumLock\'');
+
+ debug('Function Section');
+ eventSender.keyDown('escape');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'Escape\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'Escape\'');
+ eventSender.keyDown('F1');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'F1\'');
+ eventSender.keyDown('F6');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'F6\'');
+ eventSender.keyDown('F12');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'F12\'');
+ eventSender.keyDown('printScreen');
+ shouldEvaluateTo('lastKeyboardDownEvent.code', '\'PrintScreen\'');
+ shouldEvaluateTo('lastKeyboardUpEvent.code', '\'PrintScreen\'');
+}
+</script>
« 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