From 65a606613ccb9b159026c84a3e3f717e363f1511 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 14 Dec 2021 19:21:28 +0100 Subject: [PATCH] test(material/snack-bar): fix error logs in tests (#24074) The snack bar tests were logging `'dir-with-view-container' is not a known element` errors, because the component wasn't added to the `declarations` after the `entryComponents` cleanup. This didn't break the CI, because Angular uses `console.error` for unknown element errors. --- src/material-experimental/mdc-snack-bar/snack-bar.spec.ts | 4 ++-- src/material/snack-bar/snack-bar.spec.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/material-experimental/mdc-snack-bar/snack-bar.spec.ts b/src/material-experimental/mdc-snack-bar/snack-bar.spec.ts index 710913e3fbc1..b8fedddde6c7 100644 --- a/src/material-experimental/mdc-snack-bar/snack-bar.spec.ts +++ b/src/material-experimental/mdc-snack-bar/snack-bar.spec.ts @@ -691,7 +691,7 @@ describe('MatSnackBar with parent MatSnackBar', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ imports: [MatSnackBarModule, CommonModule, NoopAnimationsModule], - declarations: [ComponentThatProvidesMatSnackBar], + declarations: [ComponentThatProvidesMatSnackBar, DirectiveWithViewContainer], }).compileComponents(); })); @@ -765,7 +765,7 @@ describe('MatSnackBar Positioning', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ imports: [MatSnackBarModule, CommonModule, NoopAnimationsModule], - declarations: [ComponentWithChildViewContainer], + declarations: [ComponentWithChildViewContainer, DirectiveWithViewContainer], }).compileComponents(); })); diff --git a/src/material/snack-bar/snack-bar.spec.ts b/src/material/snack-bar/snack-bar.spec.ts index f7c67d2276bc..d1dc01f64606 100644 --- a/src/material/snack-bar/snack-bar.spec.ts +++ b/src/material/snack-bar/snack-bar.spec.ts @@ -751,7 +751,7 @@ describe('MatSnackBar with parent MatSnackBar', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ imports: [MatSnackBarModule, CommonModule, NoopAnimationsModule], - declarations: [ComponentThatProvidesMatSnackBar], + declarations: [ComponentThatProvidesMatSnackBar, DirectiveWithViewContainer], }).compileComponents(); })); @@ -825,7 +825,7 @@ describe('MatSnackBar Positioning', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ imports: [MatSnackBarModule, CommonModule, NoopAnimationsModule], - declarations: [ComponentWithChildViewContainer], + declarations: [ComponentWithChildViewContainer, DirectiveWithViewContainer], }).compileComponents(); }));