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

Side by Side Diff: tests/html/interactive_test.dart

Issue 12419011: Modern-ify KeyEvent handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: \ Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library interactive_test; 5 library interactive_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import '../../pkg/unittest/lib/unittest.dart'; 9 import '../../pkg/unittest/lib/unittest.dart';
10 import '../../pkg/unittest/lib/html_individual_config.dart'; 10 import '../../pkg/unittest/lib/html_individual_config.dart';
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 }); 86 });
87 87
88 document.body.append(video); 88 document.body.append(video);
89 video.src = url; 89 video.src = url;
90 90
91 return completer.future; 91 return completer.future;
92 }); 92 });
93 }); 93 });
94 } 94 }
95 }); 95 });
96
97 group('KeyEvent', () {
98 keydownHandlerTest(KeyEvent e) {
99 document.body.innerHtml =
100 '${document.body.innerHtml}KeyDOWN: CharCode: ${e.charCode}, KeyCode:'
101 ' ${e.keyCode}<br />';
102 expect(e.charCode, 0);
103 }
104 keypressHandlerTest(KeyEvent e) {
105 document.body.innerHtml =
106 '${document.body.innerHtml}KeyPRESS: CharCode: ${e.charCode}, '
107 'KeyCode: ${e.keyCode}<br />';
108 }
109 keyupHandlerTest(KeyEvent e) {
110 document.body.innerHtml =
111 '${document.body.innerHtml}KeyUP: CharCode: ${e.charCode}, KeyCode:'
112 ' ${e.keyCode}<br />';
113 expect(e.charCode, 0);
114 }
115 keyupHandlerTest2(KeyEvent e) {
116 document.body.innerHtml =
117 '${document.body.innerHtml}A second KeyUP handler: CharCode: '
118 '${e.charCode}, KeyCode: ${e.keyCode}<br />';
119 expect(e.charCode, 0);
120 }
121 test('keys', () {
122 document.body.innerHtml =
123 '${document.body.innerHtml}To test keyboard event values, press some '
124 'keys on your keyboard.<br /><br />The charcode for keydown and keyup'
125 ' should be 0, and the keycode should (generally) be populated with a'
126 ' value. Keycode and charcode should both have values for the '
127 'keypress event.';
128 new KeyboardEventStream.onKeyDown(document.body).listen(
129 keydownHandlerTest);
130 new KeyboardEventStream.onKeyPress(document.body).listen(
131 keypressHandlerTest);
132 new KeyboardEventStream.onKeyUp(document.body).listen(
133 keyupHandlerTest);
134 new KeyboardEventStream.onKeyUp(document.body).listen(
135 keyupHandlerTest2);
136 });
137 });
96 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698