update method
Returns a future that completes after the DOM is reported stable.
It is import to update
before making an assertion on the DOM, as Angular
(and other services) could be waiting (asynchronously) to make a change -
and often you'd want to assert against the final state.
#Example use
expect(fixture.text, contains('Loading...'));
await fixture.update();
expect(fixture.text, contains('Hello World'));
Optionally, pass a run
to run before stabilizing:
await fixture.update((c) {
c.value = 5;
});
expect(fixture.text, contains('5 little piggies'));
Implementation
Future<void> update([void Function(T instance)? run]) {
return _testStabilizer.stabilize(runAndTrackSideEffects: () {
if (run != null) {
Future<void>.sync(() {
_rootComponentRef.update(run);
});
}
});
}