Skip to content

Instantly share code, notes, and snippets.

@dsebastien
Created November 15, 2020 07:01
Show Gist options
  • Save dsebastien/bedbcc69bb5f839c7df8bd71ce2520ee to your computer and use it in GitHub Desktop.
Save dsebastien/bedbcc69bb5f839c7df8bd71ce2520ee to your computer and use it in GitHub Desktop.
it('checks state while async action is in progress', async () => {
const buttonHarness = loader.getHarness(MyButtonHarness);
await manualChangeDetection(async () => {
await buttonHarness.click();
fixture.detectChanges();
// Check expectations while async click operation is in progress.
expect(isProgressSpinnerVisible()).toBe(true);
await fixture.whenStable();
// Check expectations after async click operation complete.
expect(isProgressSpinnerVisible()).toBe(false);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment