Skip to content

Commit 58a30cf

Browse files
authored
test(material/bottom-sheet): fix broken tests (#29213)
Fixes some tests that were broken by a recent change.
1 parent e731203 commit 58a30cf

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

src/material/bottom-sheet/bottom-sheet.spec.ts

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,8 @@ describe('MatBottomSheet', () => {
609609
});
610610

611611
viewContainerFixture.detectChanges();
612-
flushMicrotasks();
612+
flush();
613+
viewContainerFixture.detectChanges();
613614

614615
expect(document.activeElement!.tagName)
615616
.withContext('Expected bottom sheet container to be focused.')
@@ -658,7 +659,8 @@ describe('MatBottomSheet', () => {
658659
});
659660

660661
viewContainerFixture.detectChanges();
661-
flushMicrotasks();
662+
flush();
663+
viewContainerFixture.detectChanges();
662664

663665
let container = overlayContainerElement.querySelector(
664666
'.mat-bottom-sheet-container',
@@ -679,7 +681,8 @@ describe('MatBottomSheet', () => {
679681
});
680682

681683
viewContainerFixture.detectChanges();
682-
flushMicrotasks();
684+
flush();
685+
viewContainerFixture.detectChanges();
683686

684687
let firstHeader = overlayContainerElement.querySelector(
685688
'h1[tabindex="-1"]',
@@ -701,7 +704,8 @@ describe('MatBottomSheet', () => {
701704
});
702705

703706
viewContainerFixture.detectChanges();
704-
flushMicrotasks();
707+
flush();
708+
viewContainerFixture.detectChanges();
705709

706710
let firstParagraph = overlayContainerElement.querySelector(
707711
'p[tabindex="-1"]',
@@ -721,9 +725,10 @@ describe('MatBottomSheet', () => {
721725

722726
const bottomSheetRef = bottomSheet.open(PizzaMsg, {viewContainerRef: testViewContainerRef});
723727

724-
flushMicrotasks();
728+
flush();
729+
viewContainerFixture.detectChanges();
730+
flush();
725731
viewContainerFixture.detectChanges();
726-
flushMicrotasks();
727732

728733
expect(document.activeElement!.id).not.toBe(
729734
'bottom-sheet-trigger',
@@ -736,7 +741,7 @@ describe('MatBottomSheet', () => {
736741
'Expcted the focus not to have changed before the animation finishes.',
737742
);
738743

739-
flushMicrotasks();
744+
flush();
740745
viewContainerFixture.detectChanges();
741746
tick(500);
742747

@@ -758,9 +763,10 @@ describe('MatBottomSheet', () => {
758763
restoreFocus: false,
759764
});
760765

761-
flushMicrotasks();
766+
flush();
767+
viewContainerFixture.detectChanges();
768+
flush();
762769
viewContainerFixture.detectChanges();
763-
flushMicrotasks();
764770

765771
expect(document.activeElement!.id).not.toBe(
766772
'bottom-sheet-trigger',
@@ -773,7 +779,7 @@ describe('MatBottomSheet', () => {
773779
'Expcted the focus not to have changed before the animation finishes.',
774780
);
775781

776-
flushMicrotasks();
782+
flush();
777783
viewContainerFixture.detectChanges();
778784
tick(500);
779785

@@ -798,9 +804,10 @@ describe('MatBottomSheet', () => {
798804

799805
const bottomSheetRef = bottomSheet.open(PizzaMsg, {viewContainerRef: testViewContainerRef});
800806

801-
flushMicrotasks();
807+
flush();
808+
viewContainerFixture.detectChanges();
809+
flush();
802810
viewContainerFixture.detectChanges();
803-
flushMicrotasks();
804811

805812
expect(document.activeElement!.id).not.toBe(
806813
'bottom-sheet-trigger',

0 commit comments

Comments
 (0)