Skip to content

Commit

Permalink
test: menu tests flaky due to missing animation flush (#17935)
Browse files Browse the repository at this point in the history
Follow-up to: 1255139

Two recently added tests for the menu/mdc-menu and the MDC-one from the
initial commit seem to miss a `tick` to flush the open animation. Without
the flush, the `FakeAsyncTestZone` will report a pending timer on test completion.
  • Loading branch information
devversion authored and mmalerba committed Dec 11, 2019
1 parent 993a027 commit 6ae74a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/material-experimental/mdc-menu/menu.spec.ts
Expand Up @@ -854,6 +854,7 @@ describe('MDC-based MatMenu', () => {
fixture.detectChanges();
fixture.componentInstance.trigger.openMenu();
fixture.detectChanges();
tick(500);

expect(document.activeElement)
.toBe(overlayContainerElement.querySelector('.mat-mdc-menu-panel'));
Expand All @@ -865,6 +866,7 @@ describe('MDC-based MatMenu', () => {
fixture.detectChanges();
fixture.componentInstance.trigger.openMenu();
fixture.detectChanges();
tick(500);

expect(document.activeElement)
.toBe(overlayContainerElement.querySelector('.mat-mdc-menu-panel'));
Expand Down
1 change: 1 addition & 0 deletions src/material/menu/menu.spec.ts
Expand Up @@ -807,6 +807,7 @@ describe('MatMenu', () => {
fixture.detectChanges();
fixture.componentInstance.trigger.openMenu();
fixture.detectChanges();
tick(500);

expect(document.activeElement).toBe(overlayContainerElement.querySelector('.mat-menu-panel'));
}));
Expand Down

0 comments on commit 6ae74a0

Please sign in to comment.