dart-sdk/tests/html/gamepad_test.dart
Harry Terkelsen 1d749a2fec record that Gamepad.buttons creates GamepadButtons
This also extends the html generator to be able to generate List implementations with nullable element types

Fixes https://github.com/dart-lang/sdk/issues/27073

R=sra@google.com, terry@google.com

Review URL: https://codereview.chromium.org/2242203002 .
2016-08-16 13:56:32 -07: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);
}
}
});
}