OLD | NEW |
(Empty) | |
| 1 library KeyboardEventTest; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_config.dart'; |
| 4 import 'dart:html'; |
| 5 |
| 6 // Test that we are correctly determining keyCode and charCode uniformly across |
| 7 // browsers. |
| 8 |
| 9 main() { |
| 10 |
| 11 useHtmlConfiguration(); |
| 12 |
| 13 keydownHandlerTest(KeyEvent e) { |
| 14 expect(e.charCode, 0); |
| 15 } |
| 16 |
| 17 test('keys', () { |
| 18 // This test currently is pretty much a no-op because we |
| 19 // can't (right now) construct KeyboardEvents with specific keycode/charcode |
| 20 // values (a KeyboardEvent can be "init"-ed but not all the information can |
| 21 // be programmatically populated. It exists as an example for how to use |
| 22 // KeyboardEventController more than anything else. |
| 23 var controller = new KeyboardEventController.keydown(document.window); |
| 24 var func = keydownHandlerTest; |
| 25 controller.add(func); |
| 26 document.window.on.keyDown.add((e) => print('regular listener'), false); |
| 27 controller.remove(func); |
| 28 }); |
| 29 } |
| 30 |
| 31 |
OLD | NEW |