f46672cb73
BUG= Review URL: https://codereview.chromium.org//12040059 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17735 260f80e4-7a28-3924-810f-c04153c831b5
34 lines
1023 B
Dart
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'));
|
|
});
|
|
}
|
|
|
|
|