fix(testing): add discardPeriodicTasks to be used with fakeAsync (#8629)

Closes #8616
This commit is contained in:
Julie Ralph
2016-05-26 10:19:30 -07:00
committed by Miško Hevery
parent b2e804c961
commit 0cb93a436d
3 changed files with 34 additions and 0 deletions

View File

@ -80,6 +80,15 @@ export function tick(millis: number = 0): void {
_getFakeAsyncZoneSpec().tick(millis);
}
/**
* Discard all remaining periodic tasks.
*/
export function discardPeriodicTasks(): void {
let zoneSpec = _getFakeAsyncZoneSpec();
let pendingTimers = zoneSpec.pendingPeriodicTimers;
zoneSpec.pendingPeriodicTimers.length = 0;
}
/**
* Flush any pending microtasks.
*/