Skip to content

Commit 92f7e6c

Browse files
crisbetoamysorto
authored andcommitted
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. (cherry picked from commit 65a6066)
1 parent a07761f commit 92f7e6c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/material-experimental/mdc-snack-bar/snack-bar.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ describe('MatSnackBar with parent MatSnackBar', () => {
691691
beforeEach(fakeAsync(() => {
692692
TestBed.configureTestingModule({
693693
imports: [MatSnackBarModule, CommonModule, NoopAnimationsModule],
694-
declarations: [ComponentThatProvidesMatSnackBar],
694+
declarations: [ComponentThatProvidesMatSnackBar, DirectiveWithViewContainer],
695695
}).compileComponents();
696696
}));
697697

@@ -765,7 +765,7 @@ describe('MatSnackBar Positioning', () => {
765765
beforeEach(fakeAsync(() => {
766766
TestBed.configureTestingModule({
767767
imports: [MatSnackBarModule, CommonModule, NoopAnimationsModule],
768-
declarations: [ComponentWithChildViewContainer],
768+
declarations: [ComponentWithChildViewContainer, DirectiveWithViewContainer],
769769
}).compileComponents();
770770
}));
771771

src/material/snack-bar/snack-bar.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ describe('MatSnackBar with parent MatSnackBar', () => {
751751
beforeEach(fakeAsync(() => {
752752
TestBed.configureTestingModule({
753753
imports: [MatSnackBarModule, CommonModule, NoopAnimationsModule],
754-
declarations: [ComponentThatProvidesMatSnackBar],
754+
declarations: [ComponentThatProvidesMatSnackBar, DirectiveWithViewContainer],
755755
}).compileComponents();
756756
}));
757757

@@ -825,7 +825,7 @@ describe('MatSnackBar Positioning', () => {
825825
beforeEach(fakeAsync(() => {
826826
TestBed.configureTestingModule({
827827
imports: [MatSnackBarModule, CommonModule, NoopAnimationsModule],
828-
declarations: [ComponentWithChildViewContainer],
828+
declarations: [ComponentWithChildViewContainer, DirectiveWithViewContainer],
829829
}).compileComponents();
830830
}));
831831

0 commit comments

Comments
 (0)