feat(core): update zone.js to 0.8.10 and expose the flush method (#16860)
`flush()` can now be used from within fakeAsync tests to simulate moving time forward until all macrotask events have been cleared from the event queue.
This commit is contained in:

committed by
Chuck Jazdzewski

parent
6e41add867
commit
85d4c4b82e
@ -115,6 +115,20 @@ export function tick(millis: number = 0): void {
|
||||
_getFakeAsyncZoneSpec().tick(millis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone by
|
||||
* draining the macrotask queue until it is empty. The returned value is the milliseconds
|
||||
* of time that would have been elapsed.
|
||||
*
|
||||
* @param maxTurns
|
||||
* @returns {number} The simulated time elapsed, in millis.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
export function flush(maxTurns?: number): number {
|
||||
return _getFakeAsyncZoneSpec().flush(maxTurns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Discard all remaining periodic tasks.
|
||||
*
|
||||
|
Reference in New Issue
Block a user