FakeTimeNgZoneStabilizer class

Observes NgZone, a custom parent zone, and custom hooks to stabilize.

  • Any microtasks are automatically waited for stability in update.
  • Any timers need to be manually elapsed using the elapse hook.

This stabilizer is a good choice for tests that need to assert transitional state (i.e. "idle", "loading", "loaded"), custom animations that use Timer or Future.delayed. The vast majority of tests are better off using the default (RealTimeNgZoneStabilizer) stabilizer.

NOTE: Periodic timers are not supported by this stabilizer.

Inheritance

Constructors

FakeTimeNgZoneStabilizer(TimerHookZone timerZone, NgZone ngZone, {int? maxIterations})
Creates a new stabilizer which uses a combination of zones.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isStable bool
Whether this stabilizer is currently stable.
no setterinherited
ngZone → NgZone
Instance of NgZone that was created for this stabilizer.
finalinherited
pendingTimers → PriorityQueue<_FakeTimer>
Timer instances that are currently pending execution.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

elapse(Duration time) Future<void>
Forces elapsing all timers that are less than or equal to duration time.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
stabilize({void runAndTrackSideEffects()?, int threshold = 100}) Future<void>
Runs update until it completes with false, reporting stabilized.
inherited
stabilizeWithThreshold(int threshold) Future<void>
Run update until the stabilizer is stable or threshold exceeds.
inherited
toString() String
A string representation of this object.
inherited
update([void runAndTrackSideEffects()?]) Future<bool>
Returns a future that completes after processing DOM update events.
inherited
waitForAsyncEvents() Future<void>
May be overridden to change what is awaited.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultMaxIterations → const int