NgTestStabilizer class abstract

Abstraction around services that change the state of the DOM asynchronously.

One strategy of testing Angular components is to interact with their emitted DOM as-if you were a user with a browser, and assert the state of the DOM instead of the state of the component. For example, a toggle button that switches between 'Yes' and 'No' when clicked:

testToggleButton(ButtonElement button) {
  expect(button.text, 'Yes');
  button.click();
  expect(button.text, 'No');
}
```dart

In the case of Angular, and of other DOM-related libraries, however, the
changes are not always applied immediately (synchronously). Instead, we need
a contract that lets us `await` any possible changes, and then assert state:
```dart
testToggleButton(ButtonElement button, NgTestStabilizer dom) async {
  expect(button.text, 'Yes');
  await dom.update(() => button.click());
  expect(button.text, 'No');
}

Either extend or implement NgTestStabilizer.

Implementers

Constructors

NgTestStabilizer()
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
isStable → bool
Whether this stabilizer is currently stable.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

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.
stabilizeWithThreshold(int threshold) → Future<void>
Run update until the stabilizer is stable or threshold exceeds.
toString() → String
A string representation of this object.
inherited
update([void runAndTrackSideEffects()?]) → Future<bool>
Returns a future that completes after processing DOM update events.

Operators

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

Constants

alwaysStable → const NgTestStabilizer