Chromium Code Reviews| Index: tests/html/interactive_test.dart |
| diff --git a/tests/html/interactive_test.dart b/tests/html/interactive_test.dart |
| index 47bbe08475b4b8e2368c02e5c99d9a30192094af..ebc0ff238c61dd8ee68e27dc612bf41ef299eb1a 100644 |
| --- a/tests/html/interactive_test.dart |
| +++ b/tests/html/interactive_test.dart |
| @@ -93,4 +93,46 @@ main() { |
| }); |
| } |
| }); |
| + |
| + group('KeyEvent', () { |
| + keydownHandlerTest(KeyEvent e) { |
| + document.body.innerHtml = |
| + '${document.body.innerHtml}KeyDOWN: CharCode: ${e.charCode}, KeyCode:' |
| + ' ${e.keyCode}<br />'; |
| + expect(e.charCode, 0); |
| + } |
| + keypressHandlerTest(KeyEvent e) { |
| + document.body.innerHtml = |
| + '${document.body.innerHtml}KeyPRESS: CharCode: ${e.charCode}, ' |
| + 'KeyCode: ${e.keyCode}<br />'; |
| + } |
| + keyupHandlerTest(KeyEvent e) { |
| + document.body.innerHtml = |
| + '${document.body.innerHtml}KeyUP: CharCode: ${e.charCode}, KeyCode:' |
| + ' ${e.keyCode}<br />'; |
| + expect(e.charCode, 0); |
| + } |
| + keyupHandlerTest2(KeyEvent e) { |
| + document.body.innerHtml = |
| + '${document.body.innerHtml}A second KeyUP handler: CharCode: ' |
| + '${e.charCode}, KeyCode: ${e.keyCode}<br />'; |
| + expect(e.charCode, 0); |
| + } |
| + test('keys', () { |
| + document.body.innerHtml = |
|
Andrei Mouravski
2013/03/22 19:12:33
What are you actually testing here?
Emily Fortuna
2013/03/22 22:53:58
It is a visual test -- (hence in the "interactive_
|
| + '${document.body.innerHtml}To test keyboard event values, press some ' |
| + 'keys on your keyboard.<br /><br />The charcode for keydown and keyup' |
| + ' should be 0, and the keycode should (generally) be populated with a' |
| + ' value. Keycode and charcode should both have values for the ' |
| + 'keypress event.'; |
| + new KeyboardEventStream.onKeyDown(document.body).listen( |
| + keydownHandlerTest); |
| + new KeyboardEventStream.onKeyPress(document.body).listen( |
| + keypressHandlerTest); |
| + new KeyboardEventStream.onKeyUp(document.body).listen( |
| + keyupHandlerTest); |
| + new KeyboardEventStream.onKeyUp(document.body).listen( |
| + keyupHandlerTest2); |
| + }); |
| + }); |
| } |