fix(testing): add discardPeriodicTasks to be used with fakeAsync (#8629)
Closes #8616
This commit is contained in:

committed by
Miško Hevery

parent
b2e804c961
commit
0cb93a436d
@ -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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user