dart-sdk/tests/lib/html/gamepad_test.dart
Srujan Gaddam 5b2482004b [dart:html] Migrate tests that need changes to NNBD
Remaining tests that don't belong to any real test suite, but
need some changes beyond just null asserts to be migrated.

Change-Id: I91c0cb02eb72ada572a10c567b5d8bac596b16a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142445
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-04-06 20:41:14 +00:00

33 lines
955 B
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
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);
}
}
});
}