Files
sdk/tests/html/keyboard_event_test.dart
T
2013-01-28 23:31:15 +00:00

34 lines
1023 B
Dart

library KeyboardEventTest;
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
// Test that we are correctly determining keyCode and charCode uniformly across
// browsers.
main() {
useHtmlConfiguration();
keydownHandlerTest(KeyEvent e) {
expect(e.charCode, 0);
}
test('keyboardEvent constructor', () {
var event = new KeyboardEvent('keyup');
});
test('keys', () {
// This test currently is pretty much a no-op because we
// can't (right now) construct KeyboardEvents with specific keycode/charcode
// values (a KeyboardEvent can be "init"-ed but not all the information can
// be programmatically populated. It exists as an example for how to use
// KeyboardEventController more than anything else.
var controller = new KeyboardEventController.keydown(document.body);
var func = keydownHandlerTest;
controller.add(func);
document.body.onKeyDown.listen((e) => print('regular listener'));
});
}