mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 15:17:07 +00:00
Migrate events_test to async_minitest
Change-Id: I994d376d3a6a86be989130104fabdc6d217fc0e1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139492 Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
parent
c27af75504
commit
739e79e863
1 changed files with 5 additions and 13 deletions
|
@ -6,16 +6,8 @@ library tests.html.events_test;
|
|||
|
||||
import 'dart:async';
|
||||
import 'dart:html';
|
||||
import 'package:unittest/unittest.dart';
|
||||
import 'package:unittest/src/expected_function.dart' show ExpectedFunction;
|
||||
|
||||
T Function() expectAsync0<T>(T Function() callback,
|
||||
{int count: 1, int max: 0}) =>
|
||||
new ExpectedFunction<T>(callback, count, max).max0;
|
||||
|
||||
T Function(A) expectAsync1<T, A>(T Function(A) callback,
|
||||
{int count: 1, int max: 0}) =>
|
||||
new ExpectedFunction<T>(callback, count, max).max1;
|
||||
import 'package:async_helper/async_minitest.dart';
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
main() {
|
||||
test('TimeStamp', () {
|
||||
|
@ -55,7 +47,7 @@ main() {
|
|||
|
||||
invocationCounter = 0;
|
||||
element.dispatchEvent(event);
|
||||
expect(invocationCounter, isZero);
|
||||
expect(invocationCounter, 0);
|
||||
|
||||
var provider = new EventStreamProvider<Event>('test');
|
||||
|
||||
|
@ -67,7 +59,7 @@ main() {
|
|||
sub.cancel();
|
||||
invocationCounter = 0;
|
||||
element.dispatchEvent(event);
|
||||
expect(invocationCounter, isZero);
|
||||
expect(invocationCounter, 0);
|
||||
|
||||
provider.forTarget(element).listen(handler);
|
||||
invocationCounter = 0;
|
||||
|
@ -105,7 +97,7 @@ main() {
|
|||
// rely on this. We therefore wrap it into an expectAsync.
|
||||
runZoned(expectAsync0(() {
|
||||
var zone = Zone.current;
|
||||
expect(zone, isNot(equals(Zone.root)));
|
||||
Expect.notEquals(zone, Zone.root);
|
||||
|
||||
StreamSubscription<Event> sub;
|
||||
|
||||
|
|
Loading…
Reference in a new issue