Skip to content

Commit

Permalink
test(multiple): remove CommonModule imports (#29900)
Browse files Browse the repository at this point in the history
Removes all our imports of `CommonModule` in tests since it wasn't being used for anything.
  • Loading branch information
crisbeto authored Oct 23, 2024
1 parent b519b47 commit fa0f514
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 98 deletions.
3 changes: 1 addition & 2 deletions src/cdk-experimental/popover-edit/popover-edit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {DataSource} from '@angular/cdk/collections';
import {DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, TAB, UP_ARROW} from '@angular/cdk/keycodes';
import {CdkTableModule} from '@angular/cdk/table';
import {dispatchKeyboardEvent} from '@angular/cdk/testing/private';
import {CommonModule} from '@angular/common';
import {
ChangeDetectorRef,
Component,
Expand Down Expand Up @@ -399,7 +398,7 @@ describe('CDK Popover Edit', () => {

beforeEach(fakeAsync(() => {
TestBed.configureTestingModule({
imports: [CdkTableModule, CdkPopoverEditModule, CommonModule, FormsModule, BidiModule],
imports: [CdkTableModule, CdkPopoverEditModule, FormsModule, BidiModule],
declarations: [componentClass],
});
fixture = TestBed.createComponent<BaseTestComponent>(componentClass);
Expand Down
2 changes: 0 additions & 2 deletions src/cdk/listbox/listbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
SPACE,
UP_ARROW,
} from '@angular/cdk/keycodes';
import {CommonModule} from '@angular/common';
import {Component, Type, signal} from '@angular/core';
import {TestBed, fakeAsync, tick} from '@angular/core/testing';
import {FormControl, ReactiveFormsModule} from '@angular/forms';
Expand Down Expand Up @@ -532,7 +531,6 @@ describe('CdkOption and CdkListbox', () => {
it('should allow custom function to compare option values', () => {
const {fixture, listbox, options} = setupComponent<ListboxWithObjectValues, {name: string}>(
ListboxWithObjectValues,
[CommonModule],
);
listbox.value = [{name: 'Banana'}];
fixture.detectChanges();
Expand Down
4 changes: 1 addition & 3 deletions src/cdk/portal/portal.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {CommonModule} from '@angular/common';
import {
AfterViewInit,
ApplicationRef,
Expand All @@ -24,7 +23,6 @@ describe('Portals', () => {
TestBed.configureTestingModule({
imports: [
PortalModule,
CommonModule,
PortalTestApp,
UnboundPortalTestApp,
ArbitraryViewContainerRefComponent,
Expand Down Expand Up @@ -728,7 +726,7 @@ class ChocolateInjector {
selector: 'pizza-msg',
template: '<p>Pizza</p><p>{{snack}}</p><ng-content></ng-content>',
standalone: true,
imports: [PortalModule, CommonModule],
imports: [PortalModule],
})
class PizzaMsg {
snack = inject(Chocolate, {optional: true});
Expand Down
9 changes: 4 additions & 5 deletions src/cdk/scrolling/virtual-scroll-viewport.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
ScrollDispatcher,
ScrollingModule,
} from '@angular/cdk/scrolling';
import {CommonModule} from '@angular/common';
import {
ApplicationRef,
Component,
Expand Down Expand Up @@ -1004,7 +1003,7 @@ describe('CdkVirtualScrollViewport', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ScrollingModule, CommonModule, DelayedInitializationVirtualScroll],
imports: [ScrollingModule, DelayedInitializationVirtualScroll],
});
fixture = TestBed.createComponent(DelayedInitializationVirtualScroll);
testComponent = fixture.componentInstance;
Expand Down Expand Up @@ -1034,7 +1033,7 @@ describe('CdkVirtualScrollViewport', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ScrollingModule, CommonModule, VirtualScrollWithAppendOnly],
imports: [ScrollingModule, VirtualScrollWithAppendOnly],
});
fixture = TestBed.createComponent(VirtualScrollWithAppendOnly);
testComponent = fixture.componentInstance;
Expand Down Expand Up @@ -1441,7 +1440,7 @@ class VirtualScrollWithItemInjectingViewContainer {
`,
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [ScrollingModule, CommonModule],
imports: [ScrollingModule],
})
class DelayedInitializationVirtualScroll {
@ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport;
Expand Down Expand Up @@ -1480,7 +1479,7 @@ class DelayedInitializationVirtualScroll {
`,
encapsulation: ViewEncapsulation.None,
standalone: true,
imports: [ScrollingModule, CommonModule],
imports: [ScrollingModule],
})
class VirtualScrollWithAppendOnly {
@ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport;
Expand Down
3 changes: 1 addition & 2 deletions src/material-experimental/popover-edit/popover-edit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {DataSource} from '@angular/cdk/collections';
import {DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, TAB, UP_ARROW} from '@angular/cdk/keycodes';
import {CommonModule} from '@angular/common';
import {Component, Directive, ElementRef, ViewChild} from '@angular/core';
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
import {FormsModule, NgForm} from '@angular/forms';
Expand Down Expand Up @@ -302,7 +301,7 @@ describe('Material Popover Edit', () => {

beforeEach(fakeAsync(() => {
TestBed.configureTestingModule({
imports: [MatTableModule, MatPopoverEditModule, CommonModule, FormsModule],
imports: [MatTableModule, MatPopoverEditModule, FormsModule],
declarations: [componentClass],
});
fixture = TestBed.createComponent(componentClass);
Expand Down
10 changes: 4 additions & 6 deletions src/material/button-toggle/button-toggle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {dispatchMouseEvent} from '@angular/cdk/testing/private';
import {CommonModule} from '@angular/common';
import {Component, DebugElement, QueryList, ViewChild, ViewChildren} from '@angular/core';
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
Expand All @@ -19,7 +18,6 @@ describe('MatButtonToggle with forms', () => {
MatButtonToggleModule,
FormsModule,
ReactiveFormsModule,
CommonModule,
ButtonToggleGroupWithNgModel,
ButtonToggleGroupWithFormControl,
ButtonToggleGroupWithIndirectDescendantToggles,
Expand Down Expand Up @@ -1112,7 +1110,7 @@ class ButtonTogglesInsideButtonToggleGroup {
</mat-button-toggle-group>
`,
standalone: true,
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule, CommonModule],
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule],
})
class ButtonToggleGroupWithNgModel {
groupName = 'group-name';
Expand Down Expand Up @@ -1191,7 +1189,7 @@ class ButtonToggleGroupWithInitialValue {
</mat-button-toggle-group>
`,
standalone: true,
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule, CommonModule],
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule],
})
class ButtonToggleGroupWithFormControl {
control = new FormControl('');
Expand All @@ -1209,7 +1207,7 @@ class ButtonToggleGroupWithFormControl {
</mat-button-toggle-group>
`,
standalone: true,
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule, CommonModule],
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule],
})
class ButtonToggleGroupWithIndirectDescendantToggles {
control = new FormControl('');
Expand Down Expand Up @@ -1297,7 +1295,7 @@ class ButtonToggleWithStaticAriaAttributes {}
</mat-button-toggle-group>
`,
standalone: true,
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule, CommonModule],
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule],
})
class ButtonToggleGroupWithFormControlAndDynamicButtons {
@ViewChildren(MatButtonToggle) toggles: QueryList<MatButtonToggle>;
Expand Down
7 changes: 3 additions & 4 deletions src/material/chips/chip-set.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {CommonModule} from '@angular/common';
import {Component, DebugElement, QueryList} from '@angular/core';
import {ComponentFixture, TestBed, fakeAsync, tick, waitForAsync} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
Expand All @@ -7,7 +6,7 @@ import {MatChip, MatChipSet, MatChipsModule} from './index';
describe('MatChipSet', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatChipsModule, CommonModule, BasicChipSet, IndirectDescendantsChipSet],
imports: [MatChipsModule, BasicChipSet, IndirectDescendantsChipSet],
});
}));

Expand Down Expand Up @@ -117,7 +116,7 @@ describe('MatChipSet', () => {
</mat-chip-set>
`,
standalone: true,
imports: [MatChipsModule, CommonModule],
imports: [MatChipsModule],
})
class BasicChipSet {
name: string = 'Test';
Expand All @@ -135,6 +134,6 @@ class BasicChipSet {
</mat-chip-set>
`,
standalone: true,
imports: [MatChipsModule, CommonModule],
imports: [MatChipsModule],
})
class IndirectDescendantsChipSet extends BasicChipSet {}
2 changes: 0 additions & 2 deletions src/material/datepicker/datepicker-actions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {CommonModule} from '@angular/common';
import {Component, ElementRef, Type, ViewChild} from '@angular/core';
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
Expand All @@ -14,7 +13,6 @@ describe('MatDatepickerActions', () => {
TestBed.configureTestingModule({
declarations: [component],
imports: [
CommonModule,
FormsModule,
MatDatepickerModule,
MatFormFieldModule,
Expand Down
24 changes: 11 additions & 13 deletions src/material/progress-spinner/progress-spinner.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {waitForAsync, TestBed} from '@angular/core/testing';
import {CommonModule} from '@angular/common';
import {By} from '@angular/platform-browser';
import {Component, ElementRef, ViewChild, ViewEncapsulation, signal} from '@angular/core';
import {MatProgressSpinnerModule} from './module';
Expand All @@ -10,7 +9,6 @@ describe('MatProgressSpinner', () => {
TestBed.configureTestingModule({
imports: [
MatProgressSpinnerModule,
CommonModule,
BasicProgressSpinner,
IndeterminateProgressSpinner,
ProgressSpinnerWithValueAndBoundMode,
Expand Down Expand Up @@ -398,14 +396,14 @@ describe('MatProgressSpinner', () => {
@Component({
template: '<mat-progress-spinner></mat-progress-spinner>',
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class BasicProgressSpinner {}

@Component({
template: '<mat-progress-spinner [strokeWidth]="strokeWidth"></mat-progress-spinner>',
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class ProgressSpinnerCustomStrokeWidth {
strokeWidth: number;
Expand All @@ -414,7 +412,7 @@ class ProgressSpinnerCustomStrokeWidth {
@Component({
template: '<mat-progress-spinner [diameter]="diameter"></mat-progress-spinner>',
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class ProgressSpinnerCustomDiameter {
diameter: number;
Expand All @@ -423,14 +421,14 @@ class ProgressSpinnerCustomDiameter {
@Component({
template: '<mat-progress-spinner mode="indeterminate"></mat-progress-spinner>',
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class IndeterminateProgressSpinner {}

@Component({
template: '<mat-progress-spinner [value]="value()" [mode]="mode()"></mat-progress-spinner>',
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class ProgressSpinnerWithValueAndBoundMode {
mode = signal('indeterminate');
Expand All @@ -441,7 +439,7 @@ class ProgressSpinnerWithValueAndBoundMode {
template: `
<mat-spinner [color]="color()"></mat-spinner>`,
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class SpinnerWithColor {
color = signal('primary');
Expand All @@ -451,7 +449,7 @@ class SpinnerWithColor {
template: `
<mat-progress-spinner value="50" [color]="color()"></mat-progress-spinner>`,
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class ProgressSpinnerWithColor {
color = signal('primary');
Expand All @@ -462,7 +460,7 @@ class ProgressSpinnerWithColor {
<mat-progress-spinner value="25" diameter="37" strokeWidth="11"></mat-progress-spinner>
`,
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class ProgressSpinnerWithStringValues {}

Expand All @@ -472,7 +470,7 @@ class ProgressSpinnerWithStringValues {}
`,
encapsulation: ViewEncapsulation.ShadowDom,
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class IndeterminateSpinnerInShadowDom {
diameter: number;
Expand All @@ -488,7 +486,7 @@ class IndeterminateSpinnerInShadowDom {
`,
encapsulation: ViewEncapsulation.ShadowDom,
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class IndeterminateSpinnerInShadowDomWithNgIf {
@ViewChild(MatProgressSpinner, {read: ElementRef})
Expand All @@ -500,6 +498,6 @@ class IndeterminateSpinnerInShadowDomWithNgIf {
@Component({
template: '<mat-spinner mode="determinate"></mat-spinner>',
standalone: true,
imports: [MatProgressSpinnerModule, CommonModule],
imports: [MatProgressSpinnerModule],
})
class SpinnerWithMode {}
Loading

0 comments on commit fa0f514

Please sign in to comment.