Files
sdk/tests/lib_2/html/gamepad_test.dart
T
Srujan Gaddam 6ae9dedc60 Migrate html tests off of unittest.dart
Changed tests either use expect/minitest or async_helper/async_minitest
as a replacement. There are still a few outstanding tests that need to
be migrated off of unittest.dart.

Change-Id: I9231d453f61507110b5a89360dfb9e5647a5b4c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135420
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-02-15 05:01:30 +00:00

30 lines
735 B
Dart

import 'package:expect/minitest.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;
}
test("getGamepads", () {
insertTestDiv();
var gamepads = window.navigator.getGamepads();
expect(gamepads, isGamepadList);
for (var gamepad in gamepads) {
if (gamepad != null) {
expect(gamepad.id, isNotNull);
}
}
});
}