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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
OLDNEW
1 library KeyboardEventTest; 1 library KeyboardEventTest;
2
2 import 'package:unittest/unittest.dart'; 3 import 'package:unittest/unittest.dart';
3 import 'package:unittest/html_config.dart'; 4 import 'package:unittest/html_config.dart';
4 import 'dart:html'; 5 import 'dart:html';
5 6
6 // Test that we are correctly determining keyCode and charCode uniformly across 7 // Test that we are correctly determining keyCode and charCode uniformly across
7 // browsers. 8 // browsers.
8 9
9 main() { 10 main() {
10
11 useHtmlConfiguration(); 11 useHtmlConfiguration();
12 12
13 keydownHandlerTest(KeyEvent e) { 13 keydownHandlerTest(KeyEvent e) {
14 expect(e.charCode, 0); 14 expect(e.charCode, 0);
15 } 15 }
16 16
17 test('keyboardEvent constructor', () { 17 test('keyboardEvent constructor', () {
18 var event = new KeyboardEvent('keyup'); 18 var event = new KeyboardEvent('keyup');
19 }); 19 });
20 test('keys', () { 20 test('keys', () {
21 var subscription = KeyboardEventStream.onKeyDown(document.body).listen( 21 var subscription =
22 keydownHandlerTest); 22 KeyboardEventStream.onKeyDown(document.body).listen(keydownHandlerTest);
23 var subscription2 = KeyEvent.keyDownEvent.forTarget(document.body).listen( 23 var subscription2 = KeyEvent.keyDownEvent
24 keydownHandlerTest); 24 .forTarget(document.body)
25 var subscription3 = document.body.onKeyDown.listen( 25 .listen(keydownHandlerTest);
26 (e) => print('regular listener')); 26 var subscription3 =
27 document.body.onKeyDown.listen((e) => print('regular listener'));
27 subscription.cancel(); 28 subscription.cancel();
28 subscription2.cancel(); 29 subscription2.cancel();
29 subscription3.cancel(); 30 subscription3.cancel();
30 }); 31 });
31 32
32 test('constructKeyEvent', () { 33 test('constructKeyEvent', () {
33 var stream = KeyEvent.keyPressEvent.forTarget(document.body); 34 var stream = KeyEvent.keyPressEvent.forTarget(document.body);
34 var subscription = stream.listen(expectAsync((keyEvent) { 35 var subscription = stream.listen(expectAsync((keyEvent) {
35 expect(keyEvent.charCode, 97); 36 expect(keyEvent.charCode, 97);
36 expect(keyEvent.keyCode, 65); 37 expect(keyEvent.keyCode, 65);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 }); 85 });
85 86
86 test('KeyEventKeyboardEvent', () { 87 test('KeyEventKeyboardEvent', () {
87 window.onKeyDown.listen(expectAsync((KeyboardEvent event) { 88 window.onKeyDown.listen(expectAsync((KeyboardEvent event) {
88 expect(event.keyCode, 16); 89 expect(event.keyCode, 16);
89 })); 90 }));
90 var streamDown = KeyEvent.keyDownEvent.forTarget(document.body); 91 var streamDown = KeyEvent.keyDownEvent.forTarget(document.body);
91 streamDown.add(new KeyEvent('keydown', keyCode: 16, charCode: 0)); 92 streamDown.add(new KeyEvent('keydown', keyCode: 16, charCode: 0));
92 }); 93 });
93 } 94 }
94
95
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698