| OLD | NEW |
| 1 library ClientRectTest; | |
| 2 import 'package:unittest/unittest.dart'; | 1 import 'package:unittest/unittest.dart'; |
| 3 import 'package:unittest/html_config.dart'; | 2 import 'package:unittest/html_config.dart'; |
| 4 import 'dart:html'; | 3 import 'dart:html'; |
| 5 | 4 |
| 6 main() { | 5 main() { |
| 7 | 6 var isGamepadList = |
| 8 var isRectList = | 7 predicate((x) => x is List<Gamepad>, 'is a List<Gamepad>'); |
| 9 predicate((x) => x is List<Rectangle>, 'is a List<Rectangle>'); | |
| 10 | 8 |
| 11 insertTestDiv() { | 9 insertTestDiv() { |
| 12 var element = new Element.tag('div'); | 10 var element = new Element.tag('div'); |
| 13 element.innerHtml = r''' | 11 element.innerHtml = r''' |
| 14 A large block of text should go here. Click this | 12 A large block of text should go here. Click this |
| 15 block of text multiple times to see each line | 13 block of text multiple times to see each line |
| 16 highlight with every click of the mouse button. | 14 highlight with every click of the mouse button. |
| 17 '''; | 15 '''; |
| 18 document.body.append(element); | 16 document.body.append(element); |
| 19 return element; | 17 return element; |
| 20 } | 18 } |
| 21 | 19 |
| 22 useHtmlConfiguration(); | 20 useHtmlConfiguration(); |
| 23 | 21 |
| 24 test("ClientRectList test", () { | 22 test("getGamepads", () { |
| 25 insertTestDiv(); | 23 insertTestDiv(); |
| 26 var range = new Range(); | 24 var gamepads = window.navigator.getGamepads(); |
| 27 var rects = range.getClientRects(); | 25 expect(gamepads, isGamepadList); |
| 28 expect(rects, isRectList); | 26 for (var gamepad in gamepads) { |
| 27 if (gamepad != null) { |
| 28 expect(gamepad.id, isNotNull); |
| 29 } |
| 30 } |
| 29 }); | 31 }); |
| 30 } | 32 } |
| OLD | NEW |