Skip to content

Commit 6ae74a0

Browse files
devversionmmalerba
authored andcommitted
test: menu tests flaky due to missing animation flush (#17935)
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.
1 parent 993a027 commit 6ae74a0

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/material-experimental/mdc-menu/menu.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ describe('MDC-based MatMenu', () => {
854854
fixture.detectChanges();
855855
fixture.componentInstance.trigger.openMenu();
856856
fixture.detectChanges();
857+
tick(500);
857858

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

869871
expect(document.activeElement)
870872
.toBe(overlayContainerElement.querySelector('.mat-mdc-menu-panel'));

src/material/menu/menu.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ describe('MatMenu', () => {
807807
fixture.detectChanges();
808808
fixture.componentInstance.trigger.openMenu();
809809
fixture.detectChanges();
810+
tick(500);
810811

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

0 commit comments

Comments
 (0)