From a7d1e65a51d91908559386933c9c3022d8698485 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Fri, 11 Jun 2021 20:11:38 +0300 Subject: [PATCH] test(docs-infra): fix warnings in `ThemeToggleComponent` unit tests. (#42259) due to unknown `` element This commit fixes some warnings in the unit tests of the `ThemeToggleComponent`, which were caused by the following: - The `` element used in `ToggleThemeComponent`'s template was not declared in tests. - The `dark-theme.css` and `light-theme.css` files requested by `ToggleThemeComponent` were not available. PR Close #42259 --- aio/angular.json | 12 +++++++++++- .../theme-picker/theme-toggle.component.spec.ts | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/aio/angular.json b/aio/angular.json index 73e923a1c3..2afa8f3df7 100644 --- a/aio/angular.json +++ b/aio/angular.json @@ -172,7 +172,17 @@ "src/google385281288605d160.html" ], "styles": [ - "src/styles/main.scss" + "src/styles/main.scss", + { + "inject": false, + "input": "src/styles/custom-themes/dark-theme.scss", + "bundleName": "dark-theme" + }, + { + "inject": false, + "input": "src/styles/custom-themes/light-theme.scss", + "bundleName": "light-theme" + } ], "scripts": [] } diff --git a/aio/src/app/shared/theme-picker/theme-toggle.component.spec.ts b/aio/src/app/shared/theme-picker/theme-toggle.component.spec.ts index 0dab1fc06c..9a63fa20a8 100644 --- a/aio/src/app/shared/theme-picker/theme-toggle.component.spec.ts +++ b/aio/src/app/shared/theme-picker/theme-toggle.component.spec.ts @@ -1,4 +1,5 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { MatIconModule } from '@angular/material/icon'; import { By } from '@angular/platform-browser'; import { ThemeStorage, ThemeToggleComponent } from './theme-toggle.component'; @@ -45,7 +46,7 @@ describe('ThemeToggleComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ declarations: [ ThemeToggleComponent ], - providers: [ { provide: ThemeStorage, useClass: FakeThemeStorage } ], + imports: [ MatIconModule ], }); fixture = TestBed.createComponent(ThemeToggleComponent);