Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions src/material/bottom-sheet/bottom-sheet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,8 @@ describe('MatBottomSheet', () => {
});

viewContainerFixture.detectChanges();
flushMicrotasks();
flush();
viewContainerFixture.detectChanges();

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

viewContainerFixture.detectChanges();
flushMicrotasks();
flush();
viewContainerFixture.detectChanges();

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

viewContainerFixture.detectChanges();
flushMicrotasks();
flush();
viewContainerFixture.detectChanges();

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

viewContainerFixture.detectChanges();
flushMicrotasks();
flush();
viewContainerFixture.detectChanges();

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

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

flushMicrotasks();
flush();
viewContainerFixture.detectChanges();
flush();
viewContainerFixture.detectChanges();
flushMicrotasks();

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

flushMicrotasks();
flush();
viewContainerFixture.detectChanges();
tick(500);

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

flushMicrotasks();
flush();
viewContainerFixture.detectChanges();
flush();
viewContainerFixture.detectChanges();
flushMicrotasks();

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

flushMicrotasks();
flush();
viewContainerFixture.detectChanges();
tick(500);

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

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

flushMicrotasks();
flush();
viewContainerFixture.detectChanges();
flush();
viewContainerFixture.detectChanges();
flushMicrotasks();

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