diff --git a/src/cdk/a11y/aria-describer/aria-describer.spec.ts b/src/cdk/a11y/aria-describer/aria-describer.spec.ts index 787dc25d3a76..739f8e605e87 100644 --- a/src/cdk/a11y/aria-describer/aria-describer.spec.ts +++ b/src/cdk/a11y/aria-describer/aria-describer.spec.ts @@ -1,18 +1,14 @@ import {A11yModule, CDK_DESCRIBEDBY_HOST_ATTRIBUTE} from '../index'; import {AriaDescriber} from './aria-describer'; import {ComponentFixture, TestBed} from '@angular/core/testing'; -import {Component, ElementRef, ViewChild, Provider, inject} from '@angular/core'; +import {Component, ElementRef, ViewChild, inject} from '@angular/core'; describe('AriaDescriber', () => { let ariaDescriber: AriaDescriber; let component: TestApp; let fixture: ComponentFixture; - function createFixture(providers: Provider[] = []) { - TestBed.configureTestingModule({ - providers: [AriaDescriber, ...providers], - }); - + function createFixture() { fixture = TestBed.createComponent(TestApp); component = fixture.componentInstance; ariaDescriber = component.ariaDescriber; diff --git a/src/cdk/clipboard/clipboard.spec.ts b/src/cdk/clipboard/clipboard.spec.ts index c9d6cbd5cec6..716942c969a5 100644 --- a/src/cdk/clipboard/clipboard.spec.ts +++ b/src/cdk/clipboard/clipboard.spec.ts @@ -14,8 +14,6 @@ describe('Clipboard', () => { let focusedInput: HTMLElement; beforeEach(() => { - TestBed.configureTestingModule({}); - clipboard = TestBed.inject(Clipboard); document = TestBed.inject(DOCUMENT); execCommand = spyOn(document, 'execCommand').and.returnValue(true); diff --git a/src/cdk/menu/menu-bar.spec.ts b/src/cdk/menu/menu-bar.spec.ts index b396f0e7a2a0..348fad1c0c5c 100644 --- a/src/cdk/menu/menu-bar.spec.ts +++ b/src/cdk/menu/menu-bar.spec.ts @@ -45,8 +45,6 @@ describe('MenuBar', () => { let menuItems: CdkMenuItemRadio[]; beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({}); - fixture = TestBed.createComponent(MenuBarRadioGroup); fixture.detectChanges(); @@ -102,10 +100,6 @@ describe('MenuBar', () => { detectChanges(); } - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({}); - })); - beforeEach(() => { fixture = TestBed.createComponent(MultiMenuWithSubmenu); detectChanges(); diff --git a/src/cdk/observers/observe-content.spec.ts b/src/cdk/observers/observe-content.spec.ts index 82a6ea4678c5..3e4afa7e7124 100644 --- a/src/cdk/observers/observe-content.spec.ts +++ b/src/cdk/observers/observe-content.spec.ts @@ -185,8 +185,6 @@ describe('ContentObserver injectable', () => { let contentObserver: ContentObserver; beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({}); - const fixture = TestBed.createComponent(UnobservedComponentWithTextContent); fixture.autoDetectChanges(); spy = jasmine.createSpy('content observer'); diff --git a/src/cdk/scrolling/scroll-dispatcher.spec.ts b/src/cdk/scrolling/scroll-dispatcher.spec.ts index 35a7ed9777f0..6d980e639d9c 100644 --- a/src/cdk/scrolling/scroll-dispatcher.spec.ts +++ b/src/cdk/scrolling/scroll-dispatcher.spec.ts @@ -1,4 +1,4 @@ -import {TestBed, waitForAsync, fakeAsync, ComponentFixture, tick} from '@angular/core/testing'; +import {TestBed, fakeAsync, ComponentFixture, tick} from '@angular/core/testing'; import {Component, ViewChild, ElementRef} from '@angular/core'; import {CdkScrollable, ScrollDispatcher, ScrollingModule} from './public-api'; import {dispatchFakeEvent} from '../testing/private'; @@ -6,13 +6,9 @@ import {dispatchFakeEvent} from '../testing/private'; describe('ScrollDispatcher', () => { let scroll: ScrollDispatcher; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, ScrollingComponent, NestedScrollingComponent], - }); - + beforeEach(() => { scroll = TestBed.inject(ScrollDispatcher); - })); + }); describe('Basic usage', () => { let fixture: ComponentFixture; diff --git a/src/cdk/scrolling/scroll-dispatcher.zone.spec.ts b/src/cdk/scrolling/scroll-dispatcher.zone.spec.ts index 5807f90ae2c0..cff6030c2c96 100644 --- a/src/cdk/scrolling/scroll-dispatcher.zone.spec.ts +++ b/src/cdk/scrolling/scroll-dispatcher.zone.spec.ts @@ -1,5 +1,5 @@ import {Component, ElementRef, ViewChild, provideZoneChangeDetection} from '@angular/core'; -import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; +import {ComponentFixture, TestBed} from '@angular/core/testing'; import {dispatchFakeEvent} from '../testing/private'; import {ScrollDispatcher} from './scroll-dispatcher'; import {CdkScrollable} from './scrollable'; @@ -9,16 +9,15 @@ describe('ScrollDispatcher Zone.js integration', () => { let scroll: ScrollDispatcher; let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { + beforeEach(() => { TestBed.configureTestingModule({ - imports: [ScrollingModule, ScrollingComponent], providers: [provideZoneChangeDetection()], }); scroll = TestBed.inject(ScrollDispatcher); fixture = TestBed.createComponent(ScrollingComponent); fixture.detectChanges(); - })); + }); it('should not execute the global events in the Angular zone', () => { scroll.scrolled(0).subscribe(() => {}); diff --git a/src/cdk/scrolling/scrollable.spec.ts b/src/cdk/scrolling/scrollable.spec.ts index 01e8902e6ef4..7cc6ec4b4573 100644 --- a/src/cdk/scrolling/scrollable.spec.ts +++ b/src/cdk/scrolling/scrollable.spec.ts @@ -1,7 +1,7 @@ import {Direction} from '../bidi'; import {CdkScrollable, ScrollingModule} from '../scrolling'; import {Component, ElementRef, Input, ViewChild} from '@angular/core'; -import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; +import {ComponentFixture, TestBed} from '@angular/core/testing'; function expectOverlapping(el1: ElementRef, el2: ElementRef, expected = true) { const r1 = el1.nativeElement.getBoundingClientRect(); @@ -24,12 +24,6 @@ describe('CdkScrollable', () => { let testComponent: ScrollableViewport; let maxOffset = 0; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, ScrollableViewport], - }); - })); - beforeEach(() => { fixture = TestBed.createComponent(ScrollableViewport); fixture.detectChanges(); diff --git a/src/cdk/scrolling/virtual-scroll-viewport.spec.ts b/src/cdk/scrolling/virtual-scroll-viewport.spec.ts index 2357db6d4f29..c5e2fd2ef918 100644 --- a/src/cdk/scrolling/virtual-scroll-viewport.spec.ts +++ b/src/cdk/scrolling/virtual-scroll-viewport.spec.ts @@ -32,12 +32,6 @@ describe('CdkVirtualScrollViewport', () => { let testComponent: FixedSizeVirtualScroll; let viewport: CdkVirtualScrollViewport; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, FixedSizeVirtualScroll], - }); - })); - beforeEach(() => { fixture = TestBed.createComponent(FixedSizeVirtualScroll); testComponent = fixture.componentInstance; @@ -836,10 +830,6 @@ describe('CdkVirtualScrollViewport', () => { let contentWrapperEl: HTMLElement; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, FixedSizeVirtualScrollWithRtlDirection], - }); - fixture = TestBed.createComponent(FixedSizeVirtualScrollWithRtlDirection); testComponent = fixture.componentInstance; viewport = testComponent.viewport; @@ -935,12 +925,6 @@ describe('CdkVirtualScrollViewport', () => { }); describe('with no VirtualScrollStrategy', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, VirtualScrollWithNoStrategy], - }); - }); - it('should fail on construction', fakeAsync(() => { expect(() => TestBed.createComponent(VirtualScrollWithNoStrategy)).toThrowError( 'Error: cdk-virtual-scroll-viewport requires the "itemSize" property to be set.', @@ -953,16 +937,6 @@ describe('CdkVirtualScrollViewport', () => { let testComponent: VirtualScrollWithItemInjectingViewContainer; let viewport: CdkVirtualScrollViewport; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ - ScrollingModule, - VirtualScrollWithItemInjectingViewContainer, - InjectsViewContainer, - ], - }); - })); - beforeEach(() => { fixture = TestBed.createComponent(VirtualScrollWithItemInjectingViewContainer); testComponent = fixture.componentInstance; @@ -992,9 +966,6 @@ describe('CdkVirtualScrollViewport', () => { let viewport: CdkVirtualScrollViewport; beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, DelayedInitializationVirtualScroll], - }); fixture = TestBed.createComponent(DelayedInitializationVirtualScroll); testComponent = fixture.componentInstance; viewport = testComponent.viewport; @@ -1022,9 +993,6 @@ describe('CdkVirtualScrollViewport', () => { let contentWrapperEl: HTMLElement; beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, VirtualScrollWithAppendOnly], - }); fixture = TestBed.createComponent(VirtualScrollWithAppendOnly); testComponent = fixture.componentInstance; viewport = testComponent.viewport; @@ -1098,12 +1066,6 @@ describe('CdkVirtualScrollViewport', () => { let testComponent: VirtualScrollWithCustomScrollingElement; let viewport: CdkVirtualScrollViewport; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, VirtualScrollWithCustomScrollingElement], - }); - })); - beforeEach(() => { fixture = TestBed.createComponent(VirtualScrollWithCustomScrollingElement); testComponent = fixture.componentInstance; @@ -1135,12 +1097,6 @@ describe('CdkVirtualScrollViewport', () => { let testComponent: VirtualScrollWithScrollableWindow; let viewport: CdkVirtualScrollViewport; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, VirtualScrollWithScrollableWindow], - }); - })); - beforeEach(() => { fixture = TestBed.createComponent(VirtualScrollWithScrollableWindow); testComponent = fixture.componentInstance; @@ -1162,10 +1118,6 @@ describe('CdkVirtualScrollViewport', () => { }); it('should be able to query for a virtual scroll viewport as a CdkScrollable', () => { - TestBed.configureTestingModule({ - imports: [ScrollingModule, VirtualScrollableQuery], - }); - const fixture = TestBed.createComponent(VirtualScrollableQuery); fixture.detectChanges(); @@ -1385,7 +1337,7 @@ class InjectsViewContainer { } `, encapsulation: ViewEncapsulation.None, - imports: [ScrollingModule], + imports: [InjectsViewContainer, ScrollingModule], }) class VirtualScrollWithItemInjectingViewContainer { @ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport; diff --git a/src/cdk/scrolling/virtual-scroll-viewport.zone.spec.ts b/src/cdk/scrolling/virtual-scroll-viewport.zone.spec.ts index 15c8dc8d8a1e..31a9a50415f9 100644 --- a/src/cdk/scrolling/virtual-scroll-viewport.zone.spec.ts +++ b/src/cdk/scrolling/virtual-scroll-viewport.zone.spec.ts @@ -8,7 +8,7 @@ import { afterNextRender, provideZoneChangeDetection, } from '@angular/core'; -import {ComponentFixture, TestBed, fakeAsync, flush, waitForAsync} from '@angular/core/testing'; +import {ComponentFixture, TestBed, fakeAsync, flush} from '@angular/core/testing'; import {animationFrameScheduler} from 'rxjs'; import {dispatchFakeEvent} from '../testing/private'; import {ScrollingModule} from './scrolling-module'; @@ -21,16 +21,15 @@ describe('CdkVirtualScrollViewport Zone.js intergation', () => { let testComponent: FixedSizeVirtualScroll; let viewport: CdkVirtualScrollViewport; - beforeEach(waitForAsync(() => { + beforeEach(() => { TestBed.configureTestingModule({ providers: [provideZoneChangeDetection()], - imports: [ScrollingModule, FixedSizeVirtualScroll], }); fixture = TestBed.createComponent(FixedSizeVirtualScroll); testComponent = fixture.componentInstance; viewport = testComponent.viewport; - })); + }); it('should emit on viewChange inside the Angular zone', fakeAsync(() => { const zoneTest = jasmine.createSpy('zone test'); diff --git a/src/cdk/table/text-column.spec.ts b/src/cdk/table/text-column.spec.ts index aae3304a4a0f..ec160234c965 100644 --- a/src/cdk/table/text-column.spec.ts +++ b/src/cdk/table/text-column.spec.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; +import {ComponentFixture, TestBed} from '@angular/core/testing'; import { getTableTextColumnMissingNameError, @@ -14,12 +14,6 @@ describe('CdkTextColumn', () => { let component: BasicTextColumnApp; let tableElement: HTMLElement; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [CdkTableModule, BasicTextColumnApp, MissingTableApp, TextColumnWithoutNameApp], - }); - })); - beforeEach(() => { fixture = TestBed.createComponent(BasicTextColumnApp); component = fixture.componentInstance; @@ -105,7 +99,6 @@ describe('CdkTextColumn', () => { // The testing module has been initialized in the root describe group for the ripples. TestBed.resetTestingModule(); TestBed.configureTestingModule({ - imports: [CdkTableModule, BasicTextColumnApp], providers: [{provide: TEXT_COLUMN_OPTIONS, useValue: options}], }); diff --git a/src/cdk/text-field/autosize.spec.ts b/src/cdk/text-field/autosize.spec.ts index 42cdd1cd72ec..d469b4ab0012 100644 --- a/src/cdk/text-field/autosize.spec.ts +++ b/src/cdk/text-field/autosize.spec.ts @@ -1,12 +1,5 @@ import {Component, ViewChild} from '@angular/core'; -import { - ComponentFixture, - TestBed, - fakeAsync, - flush, - tick, - waitForAsync, -} from '@angular/core/testing'; +import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing'; import {FormsModule} from '@angular/forms'; import {By} from '@angular/platform-browser'; import {dispatchFakeEvent} from '../testing/private'; @@ -18,19 +11,6 @@ describe('CdkTextareaAutosize', () => { let textarea: HTMLTextAreaElement; let autosize: CdkTextareaAutosize; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [ - FormsModule, - TextFieldModule, - AutosizeTextAreaWithContent, - AutosizeTextAreaWithValue, - AutosizeTextareaWithNgModel, - AutosizeTextareaWithoutAutosize, - ], - }); - })); - beforeEach(() => { fixture = TestBed.createComponent(AutosizeTextAreaWithContent); fixture.detectChanges(); @@ -417,15 +397,6 @@ class AutosizeTextAreaWithContent { placeholder: string = ''; } -@Component({ - template: ``, - styles: textareaStyleReset, - imports: [FormsModule, TextFieldModule], -}) -class AutosizeTextAreaWithValue { - value: string = ''; -} - @Component({ template: ``, styles: textareaStyleReset, diff --git a/src/components-examples/material/grid-list/grid-list-harness/grid-list-harness-example.spec.ts b/src/components-examples/material/grid-list/grid-list-harness/grid-list-harness-example.spec.ts index 698ad125d69a..dd9b229c5ea7 100644 --- a/src/components-examples/material/grid-list/grid-list-harness/grid-list-harness-example.spec.ts +++ b/src/components-examples/material/grid-list/grid-list-harness/grid-list-harness-example.spec.ts @@ -2,7 +2,6 @@ import {ComponentFixture, TestBed} from '@angular/core/testing'; import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed'; import {MatGridListHarness, MatGridTileHarness} from '@angular/material/grid-list/testing'; import {HarnessLoader} from '@angular/cdk/testing'; -import {MatGridListModule} from '@angular/material/grid-list'; import {GridListHarnessExample} from './grid-list-harness-example'; describe('GridListHarnessExample', () => { @@ -10,9 +9,6 @@ describe('GridListHarnessExample', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatGridListModule, GridListHarnessExample], - }); fixture = TestBed.createComponent(GridListHarnessExample); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/components-examples/material/icon/icon-harness/icon-harness-example.spec.ts b/src/components-examples/material/icon/icon-harness/icon-harness-example.spec.ts index 79441357ac03..0a14e3ffc8ee 100644 --- a/src/components-examples/material/icon/icon-harness/icon-harness-example.spec.ts +++ b/src/components-examples/material/icon/icon-harness/icon-harness-example.spec.ts @@ -2,7 +2,7 @@ import {ComponentFixture, TestBed} from '@angular/core/testing'; import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed'; import {HarnessLoader, parallel} from '@angular/cdk/testing'; import {IconHarnessExample} from './icon-harness-example'; -import {MatIconModule, MatIconRegistry} from '@angular/material/icon'; +import {MatIconRegistry} from '@angular/material/icon'; import {MatIconHarness} from '@angular/material/icon/testing'; import {DomSanitizer} from '@angular/platform-browser'; @@ -11,9 +11,6 @@ describe('IconHarnessExample', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatIconModule], - }); const registry = TestBed.inject(MatIconRegistry); const sanitizer = TestBed.inject(DomSanitizer); diff --git a/src/components-examples/material/slider/slider-harness/slider-harness-example.spec.ts b/src/components-examples/material/slider/slider-harness/slider-harness-example.spec.ts index 7ddcdbf4038e..b4a0e39850ff 100644 --- a/src/components-examples/material/slider/slider-harness/slider-harness-example.spec.ts +++ b/src/components-examples/material/slider/slider-harness/slider-harness-example.spec.ts @@ -2,7 +2,6 @@ import {ComponentFixture, TestBed} from '@angular/core/testing'; import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed'; import {MatSliderHarness} from '@angular/material/slider/testing'; import {HarnessLoader} from '@angular/cdk/testing'; -import {MatSliderModule} from '@angular/material/slider'; import {SliderHarnessExample} from './slider-harness-example'; describe('SliderHarnessExample', () => { @@ -10,9 +9,6 @@ describe('SliderHarnessExample', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatSliderModule, SliderHarnessExample], - }); fixture = TestBed.createComponent(SliderHarnessExample); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/badge/badge.spec.ts b/src/material/badge/badge.spec.ts index e13a1b59c811..94800d614b44 100644 --- a/src/material/badge/badge.spec.ts +++ b/src/material/badge/badge.spec.ts @@ -13,16 +13,6 @@ describe('MatBadge', () => { let testComponent: BadgeOnInteractiveElement; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - MatBadgeModule, - BadgeOnInteractiveElement, - PreExistingBadge, - NestedBadge, - BadgeOnTemplate, - ], - }); - fixture = TestBed.createComponent(BadgeOnInteractiveElement); testComponent = fixture.debugElement.componentInstance; fixture.detectChanges(); @@ -231,10 +221,6 @@ describe('MatBadge', () => { let testComponent: BadgeOnNonInteractiveElement; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatBadgeModule, BadgeOnNonInteractiveElement], - }); - fixture = TestBed.createComponent(BadgeOnNonInteractiveElement); testComponent = fixture.debugElement.componentInstance; fixture.detectChanges(); diff --git a/src/material/badge/testing/badge-harness.spec.ts b/src/material/badge/testing/badge-harness.spec.ts index 8073b99b3288..444d31996c4f 100644 --- a/src/material/badge/testing/badge-harness.spec.ts +++ b/src/material/badge/testing/badge-harness.spec.ts @@ -10,10 +10,6 @@ describe('MatBadgeHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatBadgeModule, BadgeHarnessTest], - }); - fixture = TestBed.createComponent(BadgeHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/bottom-sheet/bottom-sheet.spec.ts b/src/material/bottom-sheet/bottom-sheet.spec.ts index f0de4f69426b..dd344711a9fc 100644 --- a/src/material/bottom-sheet/bottom-sheet.spec.ts +++ b/src/material/bottom-sheet/bottom-sheet.spec.ts @@ -48,17 +48,6 @@ describe('MatBottomSheet', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ - imports: [ - MatBottomSheetModule, - ComponentWithChildViewContainer, - ComponentWithTemplateRef, - ContentElementDialog, - PizzaMsg, - TacoMsg, - DirectiveWithViewContainer, - BottomSheetWithInjectedData, - ShadowDomComponent, - ], providers: [ {provide: Location, useClass: SpyLocation}, {provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}}, @@ -873,7 +862,6 @@ describe('MatBottomSheet with parent MatBottomSheet', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ - imports: [MatBottomSheetModule, ComponentThatProvidesMatBottomSheet], providers: [{provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}}], }); @@ -954,7 +942,6 @@ describe('MatBottomSheet with default options', () => { }; TestBed.configureTestingModule({ - imports: [MatBottomSheetModule, ComponentWithChildViewContainer, DirectiveWithViewContainer], providers: [ {provide: MAT_BOTTOM_SHEET_DEFAULT_OPTIONS, useValue: defaultConfig}, {provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}}, diff --git a/src/material/button-toggle/button-toggle.spec.ts b/src/material/button-toggle/button-toggle.spec.ts index cd2b587a8bc3..6a1177dcee73 100644 --- a/src/material/button-toggle/button-toggle.spec.ts +++ b/src/material/button-toggle/button-toggle.spec.ts @@ -1013,11 +1013,6 @@ describe('MatButtonToggle without forms', () => { describe('with tokens to hide checkmark selection indicators', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - MatButtonToggleModule, - ButtonTogglesInsideButtonToggleGroup, - ButtonTogglesInsideButtonToggleGroupMultiple, - ], providers: [ { provide: MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS, diff --git a/src/material/button-toggle/testing/button-toggle-group.spec.ts b/src/material/button-toggle/testing/button-toggle-group.spec.ts index 20d36bb2dee4..8b3e66b5616f 100644 --- a/src/material/button-toggle/testing/button-toggle-group.spec.ts +++ b/src/material/button-toggle/testing/button-toggle-group.spec.ts @@ -10,10 +10,6 @@ describe('MatButtonToggleGroupHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatButtonToggleModule, ButtonToggleGroupHarnessTest], - }); - fixture = TestBed.createComponent(ButtonToggleGroupHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/button-toggle/testing/button-toggle-harness.spec.ts b/src/material/button-toggle/testing/button-toggle-harness.spec.ts index 427b6052fff9..a3059974852c 100644 --- a/src/material/button-toggle/testing/button-toggle-harness.spec.ts +++ b/src/material/button-toggle/testing/button-toggle-harness.spec.ts @@ -10,10 +10,6 @@ describe('MatButtonToggleHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatButtonToggleModule, ButtonToggleHarnessTest], - }); - fixture = TestBed.createComponent(ButtonToggleHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/button/button.spec.ts b/src/material/button/button.spec.ts index f8f9d3aca99f..1f7233b9bf0e 100644 --- a/src/material/button/button.spec.ts +++ b/src/material/button/button.spec.ts @@ -333,7 +333,6 @@ describe('MatButton', () => { TestBed.resetTestingModule(); TestBed.configureTestingModule({ - imports: [MatButtonModule, ConfigTestApp], providers: [ { provide: MAT_BUTTON_CONFIG, @@ -419,7 +418,6 @@ describe('MatButton', () => { describe('MatFabDefaultOptions', () => { function configure(defaults: MatFabDefaultOptions) { TestBed.configureTestingModule({ - imports: [MatButtonModule, TestApp], providers: [{provide: MAT_FAB_DEFAULT_OPTIONS, useValue: defaults}], }); } diff --git a/src/material/card/card.spec.ts b/src/material/card/card.spec.ts index b2b3b82c50a4..b69572b62fdb 100644 --- a/src/material/card/card.spec.ts +++ b/src/material/card/card.spec.ts @@ -1,15 +1,10 @@ import {ComponentFixture, TestBed} from '@angular/core/testing'; import {Component, Provider, Type, signal} from '@angular/core'; -import {MatCardModule} from './card-module'; import {MatCard, MAT_CARD_CONFIG, MatCardAppearance} from './card'; describe('MatCard', () => { function createComponent(component: Type, providers: Provider[] = []): ComponentFixture { - TestBed.configureTestingModule({ - imports: [MatCardModule, component], - providers, - }); - + TestBed.configureTestingModule({providers}); return TestBed.createComponent(component); } diff --git a/src/material/card/testing/card-harness.spec.ts b/src/material/card/testing/card-harness.spec.ts index 108d1142b5d2..ca56282116d5 100644 --- a/src/material/card/testing/card-harness.spec.ts +++ b/src/material/card/testing/card-harness.spec.ts @@ -10,10 +10,6 @@ describe('MatCardHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatCardModule, CardHarnessTest], - }); - fixture = TestBed.createComponent(CardHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/checkbox/checkbox.spec.ts b/src/material/checkbox/checkbox.spec.ts index d420cf6be39a..35fac1510e74 100644 --- a/src/material/checkbox/checkbox.spec.ts +++ b/src/material/checkbox/checkbox.spec.ts @@ -1,5 +1,5 @@ import {dispatchFakeEvent} from '@angular/cdk/testing/private'; -import {ChangeDetectionStrategy, Component, DebugElement, Type} from '@angular/core'; +import {ChangeDetectionStrategy, Component, DebugElement} from '@angular/core'; import {ComponentFixture, TestBed, fakeAsync, flush, flushMicrotasks} from '@angular/core/testing'; import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms'; import {ThemePalette} from '../core'; @@ -9,20 +9,11 @@ import { MatCheckbox, MatCheckboxChange, MatCheckboxDefaultOptions, - MatCheckboxModule, } from './index'; describe('MatCheckbox', () => { let fixture: ComponentFixture; - function createComponent(componentType: Type) { - TestBed.configureTestingModule({ - imports: [MatCheckboxModule, FormsModule, ReactiveFormsModule, componentType], - }); - - return TestBed.createComponent(componentType); - } - describe('basic behaviors', () => { let checkboxDebugElement: DebugElement; let checkboxNativeElement: HTMLElement; @@ -33,7 +24,7 @@ describe('MatCheckbox', () => { let checkboxElement: HTMLElement; beforeEach(() => { - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); fixture.detectChanges(); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; @@ -587,11 +578,10 @@ describe('MatCheckbox', () => { beforeEach(() => { TestBed.resetTestingModule(); TestBed.configureTestingModule({ - imports: [MatCheckboxModule, FormsModule, ReactiveFormsModule, SingleCheckbox], providers: [{provide: MAT_CHECKBOX_DEFAULT_OPTIONS, useValue: {clickAction: 'check'}}], }); - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); fixture.detectChanges(); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; @@ -619,11 +609,10 @@ describe('MatCheckbox', () => { beforeEach(() => { TestBed.resetTestingModule(); TestBed.configureTestingModule({ - imports: [MatCheckboxModule, FormsModule, ReactiveFormsModule, SingleCheckbox], providers: [{provide: MAT_CHECKBOX_DEFAULT_OPTIONS, useValue: {clickAction: 'noop'}}], }); - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); fixture.detectChanges(); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; @@ -687,7 +676,7 @@ describe('MatCheckbox', () => { let labelElement: HTMLLabelElement; beforeEach(() => { - fixture = createComponent(CheckboxWithChangeEvent); + fixture = TestBed.createComponent(CheckboxWithChangeEvent); fixture.detectChanges(); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; @@ -735,7 +724,7 @@ describe('MatCheckbox', () => { describe('aria handling', () => { it('should use the provided aria-label', fakeAsync(() => { - fixture = createComponent(CheckboxWithAriaLabel); + fixture = TestBed.createComponent(CheckboxWithAriaLabel); const checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; const checkboxNativeElement = checkboxDebugElement.nativeElement; const inputElement = checkboxNativeElement.querySelector('input'); @@ -745,14 +734,14 @@ describe('MatCheckbox', () => { })); it('should not set the aria-label attribute if no value is provided', fakeAsync(() => { - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); fixture.detectChanges(); expect(fixture.nativeElement.querySelector('input').hasAttribute('aria-label')).toBe(false); })); it('should use the provided aria-labelledby', fakeAsync(() => { - fixture = createComponent(CheckboxWithAriaLabelledby); + fixture = TestBed.createComponent(CheckboxWithAriaLabelledby); const checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; const checkboxNativeElement = checkboxDebugElement.nativeElement; const inputElement = checkboxNativeElement.querySelector('input'); @@ -762,7 +751,7 @@ describe('MatCheckbox', () => { })); it('should not assign aria-labelledby if none is provided', fakeAsync(() => { - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); const checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; const checkboxNativeElement = checkboxDebugElement.nativeElement; const inputElement = checkboxNativeElement.querySelector('input'); @@ -772,7 +761,7 @@ describe('MatCheckbox', () => { })); it('should clear the static aria attributes from the host node', () => { - fixture = createComponent(CheckboxWithStaticAriaAttributes); + fixture = TestBed.createComponent(CheckboxWithStaticAriaAttributes); const checkbox = fixture.debugElement.query(By.directive(MatCheckbox))!.nativeElement; fixture.detectChanges(); @@ -787,7 +776,7 @@ describe('MatCheckbox', () => { let inputElement: HTMLInputElement; it('should use the provided aria-describedby', () => { - fixture = createComponent(CheckboxWithAriaDescribedby); + fixture = TestBed.createComponent(CheckboxWithAriaDescribedby); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -797,7 +786,7 @@ describe('MatCheckbox', () => { }); it('should not assign aria-describedby if none is provided', () => { - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -813,7 +802,7 @@ describe('MatCheckbox', () => { let inputElement: HTMLInputElement; it('should use the provided postive aria-expanded', () => { - fixture = createComponent(CheckboxWithPositiveAriaExpanded); + fixture = TestBed.createComponent(CheckboxWithPositiveAriaExpanded); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -823,7 +812,7 @@ describe('MatCheckbox', () => { }); it('should use the provided negative aria-expanded', () => { - fixture = createComponent(CheckboxWithNegativeAriaExpanded); + fixture = TestBed.createComponent(CheckboxWithNegativeAriaExpanded); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -833,7 +822,7 @@ describe('MatCheckbox', () => { }); it('should not assign aria-expanded if none is provided', () => { - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -849,7 +838,7 @@ describe('MatCheckbox', () => { let inputElement: HTMLInputElement; it('should use the provided aria-controls', () => { - fixture = createComponent(CheckboxWithAriaControls); + fixture = TestBed.createComponent(CheckboxWithAriaControls); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -859,7 +848,7 @@ describe('MatCheckbox', () => { }); it('should not assign aria-controls if none is provided', () => { - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -875,7 +864,7 @@ describe('MatCheckbox', () => { let inputElement: HTMLInputElement; it('should use the provided aria-owns', () => { - fixture = createComponent(CheckboxWithAriaOwns); + fixture = TestBed.createComponent(CheckboxWithAriaOwns); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -885,7 +874,7 @@ describe('MatCheckbox', () => { }); it('should not assign aria-owns if none is provided', () => { - fixture = createComponent(SingleCheckbox); + fixture = TestBed.createComponent(SingleCheckbox); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxNativeElement = checkboxDebugElement.nativeElement; inputElement = checkboxNativeElement.querySelector('input'); @@ -902,7 +891,7 @@ describe('MatCheckbox', () => { let inputElement: HTMLInputElement; beforeEach(() => { - fixture = createComponent(CheckboxWithTabIndex); + fixture = TestBed.createComponent(CheckboxWithTabIndex); fixture.detectChanges(); testComponent = fixture.debugElement.componentInstance; @@ -934,7 +923,7 @@ describe('MatCheckbox', () => { describe('with native tabindex attribute', () => { it('should properly detect native tabindex attribute', fakeAsync(() => { - fixture = createComponent(CheckboxWithTabindexAttr); + fixture = TestBed.createComponent(CheckboxWithTabindexAttr); fixture.detectChanges(); const checkbox = fixture.debugElement.query(By.directive(MatCheckbox))! @@ -946,7 +935,7 @@ describe('MatCheckbox', () => { })); it('should clear the tabindex attribute from the host element', fakeAsync(() => { - fixture = createComponent(CheckboxWithTabindexAttr); + fixture = TestBed.createComponent(CheckboxWithTabindexAttr); fixture.detectChanges(); const checkbox = fixture.debugElement.query(By.directive(MatCheckbox))!.nativeElement; @@ -956,7 +945,7 @@ describe('MatCheckbox', () => { describe('with multiple checkboxes', () => { beforeEach(() => { - fixture = createComponent(MultipleCheckboxes); + fixture = TestBed.createComponent(MultipleCheckboxes); fixture.detectChanges(); }); @@ -979,7 +968,7 @@ describe('MatCheckbox', () => { let ngModel: NgModel; beforeEach(() => { - fixture = createComponent(CheckboxWithNgModel); + fixture = TestBed.createComponent(CheckboxWithNgModel); fixture.componentInstance.isRequired = false; fixture.detectChanges(); @@ -1023,7 +1012,7 @@ describe('MatCheckbox', () => { it('should mark the element as touched on blur when inside an OnPush parent', fakeAsync(() => { fixture.destroy(); TestBed.resetTestingModule(); - fixture = createComponent(CheckboxWithNgModelAndOnPush); + fixture = TestBed.createComponent(CheckboxWithNgModelAndOnPush); fixture.detectChanges(); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; @@ -1107,7 +1096,7 @@ describe('MatCheckbox', () => { describe('with name attribute', () => { beforeEach(() => { - fixture = createComponent(CheckboxWithNameAttribute); + fixture = TestBed.createComponent(CheckboxWithNameAttribute); fixture.detectChanges(); }); @@ -1126,7 +1115,7 @@ describe('MatCheckbox', () => { let inputElement: HTMLInputElement; beforeEach(() => { - fixture = createComponent(CheckboxWithFormControl); + fixture = TestBed.createComponent(CheckboxWithFormControl); fixture.detectChanges(); checkboxDebugElement = fixture.debugElement.query(By.directive(MatCheckbox))!; @@ -1156,7 +1145,7 @@ describe('MatCheckbox', () => { let checkboxInnerContainer: HTMLElement; beforeEach(() => { - fixture = createComponent(CheckboxWithoutLabel); + fixture = TestBed.createComponent(CheckboxWithoutLabel); const checkboxDebugEl = fixture.debugElement.query(By.directive(MatCheckbox))!; checkboxInnerContainer = checkboxDebugEl.query(By.css('.mdc-form-field'))!.nativeElement; }); @@ -1177,7 +1166,6 @@ describe('MatCheckboxDefaultOptions', () => { describe('when MAT_CHECKBOX_DEFAULT_OPTIONS overridden', () => { function configure(defaults: MatCheckboxDefaultOptions) { TestBed.configureTestingModule({ - imports: [MatCheckboxModule, FormsModule, SingleCheckbox, SingleCheckbox], providers: [{provide: MAT_CHECKBOX_DEFAULT_OPTIONS, useValue: defaults}], }); } diff --git a/src/material/chips/chip-edit-input.spec.ts b/src/material/chips/chip-edit-input.spec.ts index 5a056f48fc0e..3da918c342e0 100644 --- a/src/material/chips/chip-edit-input.spec.ts +++ b/src/material/chips/chip-edit-input.spec.ts @@ -11,10 +11,6 @@ describe('MatChipEditInput', () => { let inputInstance: MatChipEditInput; beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, ChipEditInputContainer], - }); - fixture = TestBed.createComponent(ChipEditInputContainer); inputDebugElement = fixture.debugElement.query(By.directive(MatChipEditInput))!; inputInstance = inputDebugElement.injector.get(MatChipEditInput); diff --git a/src/material/chips/chip-remove.spec.ts b/src/material/chips/chip-remove.spec.ts index 3e7525af81f4..c7741930344b 100644 --- a/src/material/chips/chip-remove.spec.ts +++ b/src/material/chips/chip-remove.spec.ts @@ -10,12 +10,6 @@ describe('Chip Remove', () => { let testChip: TestChip; let chipNativeElement: HTMLElement; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, TestChip], - }); - })); - beforeEach(waitForAsync(() => { fixture = TestBed.createComponent(TestChip); testChip = fixture.debugElement.componentInstance; diff --git a/src/material/chips/chip-row.spec.ts b/src/material/chips/chip-row.spec.ts index 25c81a4a4273..75a6aafeadd8 100644 --- a/src/material/chips/chip-row.spec.ts +++ b/src/material/chips/chip-row.spec.ts @@ -27,7 +27,6 @@ describe('Row Chips', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [MatChipsModule, SingleChip], providers: [provideFakeDirectionality('ltr')], }); })); diff --git a/src/material/chips/chip-set.spec.ts b/src/material/chips/chip-set.spec.ts index c64eef460db0..bba9948b1816 100644 --- a/src/material/chips/chip-set.spec.ts +++ b/src/material/chips/chip-set.spec.ts @@ -1,15 +1,9 @@ import {Component, DebugElement, QueryList} from '@angular/core'; -import {ComponentFixture, TestBed, fakeAsync, tick, waitForAsync} from '@angular/core/testing'; +import {ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; import {MatChip, MatChipSet, MatChipsModule} from './index'; describe('MatChipSet', () => { - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, BasicChipSet, IndirectDescendantsChipSet], - }); - })); - describe('BasicChipSet', () => { let fixture: ComponentFixture; let chipSetDebugElement: DebugElement; diff --git a/src/material/chips/chip.spec.ts b/src/material/chips/chip.spec.ts index 30be3f6d5bce..0587cbd17ad1 100644 --- a/src/material/chips/chip.spec.ts +++ b/src/material/chips/chip.spec.ts @@ -12,13 +12,6 @@ describe('MatChip', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - MatChipsModule, - BasicChip, - SingleChip, - BasicChipWithStaticTabindex, - BasicChipWithBoundTabindex, - ], providers: [provideFakeDirectionality('ltr')], }); })); diff --git a/src/material/chips/testing/chip-grid-harness.spec.ts b/src/material/chips/testing/chip-grid-harness.spec.ts index 30fb679e7389..57bd519a30c4 100644 --- a/src/material/chips/testing/chip-grid-harness.spec.ts +++ b/src/material/chips/testing/chip-grid-harness.spec.ts @@ -11,10 +11,6 @@ describe('MatChipGridHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, ReactiveFormsModule, ChipGridHarnessTest], - }); - fixture = TestBed.createComponent(ChipGridHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/chips/testing/chip-harness.spec.ts b/src/material/chips/testing/chip-harness.spec.ts index 52ddafdd4c60..50d575ddef3a 100644 --- a/src/material/chips/testing/chip-harness.spec.ts +++ b/src/material/chips/testing/chip-harness.spec.ts @@ -12,10 +12,6 @@ describe('MatChipHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, MatIconModule, ChipHarnessTest], - }); - fixture = TestBed.createComponent(ChipHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/chips/testing/chip-input-harness.spec.ts b/src/material/chips/testing/chip-input-harness.spec.ts index deaded9d8547..29c6ed5eda1c 100644 --- a/src/material/chips/testing/chip-input-harness.spec.ts +++ b/src/material/chips/testing/chip-input-harness.spec.ts @@ -11,10 +11,6 @@ describe('MatChipInputHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, ChipInputHarnessTest], - }); - fixture = TestBed.createComponent(ChipInputHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/chips/testing/chip-listbox-harness.spec.ts b/src/material/chips/testing/chip-listbox-harness.spec.ts index c3db9add005f..93a083d235bc 100644 --- a/src/material/chips/testing/chip-listbox-harness.spec.ts +++ b/src/material/chips/testing/chip-listbox-harness.spec.ts @@ -10,10 +10,6 @@ describe('MatChipListboxHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, ChipListboxHarnessTest], - }); - fixture = TestBed.createComponent(ChipListboxHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/chips/testing/chip-option-harness.spec.ts b/src/material/chips/testing/chip-option-harness.spec.ts index 5f5be693bcd8..63179dbfa54d 100644 --- a/src/material/chips/testing/chip-option-harness.spec.ts +++ b/src/material/chips/testing/chip-option-harness.spec.ts @@ -10,10 +10,6 @@ describe('MatChipOptionHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, ChipOptionHarnessTest], - }); - fixture = TestBed.createComponent(ChipOptionHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/chips/testing/chip-row-harness.spec.ts b/src/material/chips/testing/chip-row-harness.spec.ts index 419e96d104eb..a76762fd8624 100644 --- a/src/material/chips/testing/chip-row-harness.spec.ts +++ b/src/material/chips/testing/chip-row-harness.spec.ts @@ -10,10 +10,6 @@ describe('MatChipRowHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, ChipRowHarnessTest], - }); - fixture = TestBed.createComponent(ChipRowHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/chips/testing/chip-set-harness.spec.ts b/src/material/chips/testing/chip-set-harness.spec.ts index 2d5bc7b3af14..bbb3a64166d9 100644 --- a/src/material/chips/testing/chip-set-harness.spec.ts +++ b/src/material/chips/testing/chip-set-harness.spec.ts @@ -10,10 +10,6 @@ describe('MatChipSetHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatChipsModule, ChipSetHarnessTest], - }); - fixture = TestBed.createComponent(ChipSetHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/core/option/option.spec.ts b/src/material/core/option/option.spec.ts index a358a65f93a5..d8a8afb57acc 100644 --- a/src/material/core/option/option.spec.ts +++ b/src/material/core/option/option.spec.ts @@ -11,12 +11,6 @@ import {SPACE, ENTER} from '@angular/cdk/keycodes'; import {MatOption, MatOptionModule, MAT_OPTION_PARENT_COMPONENT} from './index'; describe('MatOption component', () => { - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - imports: [MatOptionModule, BasicOption], - }); - })); - it('should complete the `stateChanges` stream on destroy', () => { const fixture = TestBed.createComponent(BasicOption); fixture.detectChanges(); @@ -214,7 +208,6 @@ describe('MatOption component', () => { beforeEach(waitForAsync(() => { TestBed.resetTestingModule(); TestBed.configureTestingModule({ - imports: [MatOptionModule, InsideGroup], providers: [ { provide: MAT_OPTION_PARENT_COMPONENT, diff --git a/src/material/core/ripple/ripple.spec.ts b/src/material/core/ripple/ripple.spec.ts index 56cb5786d11e..8c2f932f9088 100644 --- a/src/material/core/ripple/ripple.spec.ts +++ b/src/material/core/ripple/ripple.spec.ts @@ -36,19 +36,6 @@ describe('MatRipple', () => { } beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ - MatRippleModule, - BasicRippleContainer, - RippleContainerWithInputBindings, - RippleContainerWithoutBindings, - RippleContainerWithNgIf, - RippleCssTransitionNone, - RippleCssTransitionDurationZero, - RippleWithDomRemovalOnClick, - ], - }); - platform = TestBed.inject(Platform); // Set body margin to 0 during tests so it doesn't mess up position calculations. @@ -500,7 +487,6 @@ describe('MatRipple', () => { // The testing module has been initialized in the root describe group for the ripples. TestBed.resetTestingModule(); TestBed.configureTestingModule({ - imports: [MatRippleModule, testComponent], providers: [ {provide: MAT_RIPPLE_GLOBAL_OPTIONS, useValue: rippleConfig}, ...extraProviders, @@ -605,7 +591,6 @@ describe('MatRipple', () => { beforeEach(() => { TestBed.resetTestingModule(); TestBed.configureTestingModule({ - imports: [MatRippleModule, BasicRippleContainer], providers: [{provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}}], }); diff --git a/src/material/core/ripple/ripple.zone.spec.ts b/src/material/core/ripple/ripple.zone.spec.ts index 01dbc761c150..d11696c4eaa7 100644 --- a/src/material/core/ripple/ripple.zone.spec.ts +++ b/src/material/core/ripple/ripple.zone.spec.ts @@ -9,12 +9,6 @@ describe('MatRipple Zone.js integration', () => { let rippleTarget: HTMLElement; let originalBodyMargin: string | null; - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatRippleModule, BasicRippleContainer], - }); - }); - beforeEach(() => { // Set body margin to 0 during tests so it doesn't mess up position calculations. originalBodyMargin = document.body.style.margin; diff --git a/src/material/core/testing/optgroup-harness.spec.ts b/src/material/core/testing/optgroup-harness.spec.ts index b4e52149e0c8..08a80d02f108 100644 --- a/src/material/core/testing/optgroup-harness.spec.ts +++ b/src/material/core/testing/optgroup-harness.spec.ts @@ -10,10 +10,6 @@ describe('MatOptgroupHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatOptionModule, OptgroupHarnessTest], - }); - fixture = TestBed.createComponent(OptgroupHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/core/testing/option-harness.spec.ts b/src/material/core/testing/option-harness.spec.ts index 5f4ca157b8b9..9a7e8f6407a4 100644 --- a/src/material/core/testing/option-harness.spec.ts +++ b/src/material/core/testing/option-harness.spec.ts @@ -15,10 +15,6 @@ describe('MatOptionHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatOptionModule, OptionHarnessTest], - }); - fixture = TestBed.createComponent(OptionHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture); diff --git a/src/material/dialog/dialog.spec.ts b/src/material/dialog/dialog.spec.ts index d7cec2f24432..d68cc19fe351 100644 --- a/src/material/dialog/dialog.spec.ts +++ b/src/material/dialog/dialog.spec.ts @@ -47,7 +47,6 @@ import { MatDialogActions, MatDialogClose, MatDialogContent, - MatDialogModule, MatDialogRef, MatDialogState, MatDialogTitle, @@ -66,17 +65,6 @@ describe('MatDialog', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ - imports: [ - MatDialogModule, - ComponentWithChildViewContainer, - ComponentWithTemplateRef, - PizzaMsg, - ContentElementDialog, - DialogWithInjectedData, - DialogWithoutFocusableElements, - DirectiveWithViewContainer, - ComponentWithContentElementTemplateRef, - ], providers: [ {provide: Location, useClass: SpyLocation}, {provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}}, @@ -2035,7 +2023,6 @@ describe('MatDialog with a parent MatDialog', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ - imports: [MatDialogModule, ComponentThatProvidesMatDialog], providers: [ { provide: OverlayContainer, @@ -2144,7 +2131,6 @@ describe('MatDialog with default options', () => { }; TestBed.configureTestingModule({ - imports: [MatDialogModule, ComponentWithChildViewContainer, DirectiveWithViewContainer], providers: [ {provide: MAT_DIALOG_DEFAULT_OPTIONS, useValue: defaultConfig}, {provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}}, @@ -2205,10 +2191,6 @@ describe('MatDialog with animations enabled', () => { let viewContainerFixture: ComponentFixture; beforeEach(fakeAsync(() => { - TestBed.configureTestingModule({ - imports: [MatDialogModule, ComponentWithChildViewContainer, DirectiveWithViewContainer], - }); - dialog = TestBed.inject(MatDialog); viewContainerFixture = TestBed.createComponent(ComponentWithChildViewContainer); viewContainerFixture.detectChanges(); @@ -2259,10 +2241,6 @@ describe('MatDialog with explicit injector provided', () => { let fixture: ComponentFixture; beforeEach(fakeAsync(() => { - TestBed.configureTestingModule({ - imports: [MatDialogModule, ModuleBoundDialogParentComponent], - }); - overlayContainerElement = TestBed.inject(OverlayContainer).getContainerElement(); fixture = TestBed.createComponent(ModuleBoundDialogParentComponent); })); diff --git a/src/material/dialog/dialog.zone.spec.ts b/src/material/dialog/dialog.zone.spec.ts index 75f9ec1e7870..3abcb9ceeea1 100644 --- a/src/material/dialog/dialog.zone.spec.ts +++ b/src/material/dialog/dialog.zone.spec.ts @@ -12,7 +12,7 @@ import { inject, } from '@angular/core'; import {ComponentFixture, TestBed, fakeAsync, flush} from '@angular/core/testing'; -import {MatDialog, MatDialogModule, MatDialogRef} from '../dialog'; +import {MatDialog, MatDialogRef} from '../dialog'; import {Subject} from 'rxjs'; import {MATERIAL_ANIMATIONS} from '../core'; @@ -26,12 +26,6 @@ describe('MatDialog', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ - imports: [ - MatDialogModule, - ComponentWithChildViewContainer, - PizzaMsg, - DirectiveWithViewContainer, - ], providers: [ provideZoneChangeDetection(), {provide: Location, useClass: SpyLocation}, diff --git a/src/material/icon/icon.spec.ts b/src/material/icon/icon.spec.ts index c90c6dfdf25c..d30cee9b7d67 100644 --- a/src/material/icon/icon.spec.ts +++ b/src/material/icon/icon.spec.ts @@ -63,20 +63,6 @@ describe('MatIcon', () => { fakePath = '/$fake-path'; TestBed.configureTestingModule({ - imports: [ - MatIconModule, - IconWithColor, - IconWithLigature, - IconWithLigatureByAttribute, - IconWithCustomFontCss, - IconFromSvgName, - IconWithAriaHiddenFalse, - IconWithBindingAndNgIf, - InlineIcon, - SvgIconWithUserContent, - IconWithLigatureAndSvgBinding, - BlankIcon, - ], providers: [ provideHttpClientTesting(), { diff --git a/src/material/icon/testing/icon-harness.spec.ts b/src/material/icon/testing/icon-harness.spec.ts index 8880760b868e..cc401b9f19b2 100644 --- a/src/material/icon/testing/icon-harness.spec.ts +++ b/src/material/icon/testing/icon-harness.spec.ts @@ -12,10 +12,6 @@ describe('MatIconHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatIconModule, IconHarnessTest], - }); - const registry = TestBed.inject(MatIconRegistry); const sanitizer = TestBed.inject(DomSanitizer); diff --git a/src/material/slider/testing/slider-harness.spec.ts b/src/material/slider/testing/slider-harness.spec.ts index 996737e57305..535dd49656de 100644 --- a/src/material/slider/testing/slider-harness.spec.ts +++ b/src/material/slider/testing/slider-harness.spec.ts @@ -20,10 +20,6 @@ describe('MatSliderHarness', () => { let loader: HarnessLoader; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [MatSliderModule, SliderHarnessTest], - }); - fixture = TestBed.createComponent(SliderHarnessTest); fixture.detectChanges(); loader = TestbedHarnessEnvironment.loader(fixture);