Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
feat(mock zone): isAsyncQueueEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer committed Mar 12, 2014
1 parent 86953d0 commit c834837
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/mock/zone.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ microLeap() {
}
}

/**
* Returns whether the async queue is empty.
*/
isAsyncQueueEmpty() => _asyncQueue.isEmpty;

/**
* Simulates a clock tick by running any scheduled timers. Can only be used
* in [async] tests.Clock tick will call [microLeap] to process the microtask
Expand Down
2 changes: 2 additions & 0 deletions test/mock/zone_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ void main() {
async(() {
new Future.value('s').then((_) { thenRan = true; });
expect(thenRan).toBe(false);
expect(isAsyncQueueEmpty()).toBe(false);
microLeap();
expect(isAsyncQueueEmpty()).toBe(true);
expect(thenRan).toBe(true);
ran = true;
})();
Expand Down

0 comments on commit c834837

Please sign in to comment.