Files
sdk/tests/lib_2/html/gamepad_test.dart
T
Terry Lucas 0319fb1e87 Migrated Block 200 to Dart 2.0
R=bkonyi@google.com

Change-Id: I9d998f61c2bc3d4b9c6ea71cb1111c00983a80a5
Reviewed-on: https://dart-review.googlesource.com/11347
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2017-10-09 02:45:04 +00:00

33 lines
808 B
Dart

import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';
import 'dart:html';
main() {
var isGamepadList =
predicate((x) => x is List<Gamepad>, 'is a List<Gamepad>');
insertTestDiv() {
var element = new Element.tag('div');
element.innerHtml = r'''
A large block of text should go here. Click this
block of text multiple times to see each line
highlight with every click of the mouse button.
''';
document.body.append(element);
return element;
}
useHtmlConfiguration();
test("getGamepads", () {
insertTestDiv();
var gamepads = window.navigator.getGamepads();
expect(gamepads, isGamepadList);
for (var gamepad in gamepads) {
if (gamepad != null) {
expect(gamepad.id, isNotNull);
}
}
});
}