Skip to content

Commit fa0f514

Browse files
authored
test(multiple): remove CommonModule imports (#29900)
Removes all our imports of `CommonModule` in tests since it wasn't being used for anything.
1 parent b519b47 commit fa0f514

File tree

16 files changed

+70
-98
lines changed

16 files changed

+70
-98
lines changed

src/cdk-experimental/popover-edit/popover-edit.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {DataSource} from '@angular/cdk/collections';
33
import {DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, TAB, UP_ARROW} from '@angular/cdk/keycodes';
44
import {CdkTableModule} from '@angular/cdk/table';
55
import {dispatchKeyboardEvent} from '@angular/cdk/testing/private';
6-
import {CommonModule} from '@angular/common';
76
import {
87
ChangeDetectorRef,
98
Component,
@@ -399,7 +398,7 @@ describe('CDK Popover Edit', () => {
399398

400399
beforeEach(fakeAsync(() => {
401400
TestBed.configureTestingModule({
402-
imports: [CdkTableModule, CdkPopoverEditModule, CommonModule, FormsModule, BidiModule],
401+
imports: [CdkTableModule, CdkPopoverEditModule, FormsModule, BidiModule],
403402
declarations: [componentClass],
404403
});
405404
fixture = TestBed.createComponent<BaseTestComponent>(componentClass);

src/cdk/listbox/listbox.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
SPACE,
1010
UP_ARROW,
1111
} from '@angular/cdk/keycodes';
12-
import {CommonModule} from '@angular/common';
1312
import {Component, Type, signal} from '@angular/core';
1413
import {TestBed, fakeAsync, tick} from '@angular/core/testing';
1514
import {FormControl, ReactiveFormsModule} from '@angular/forms';
@@ -532,7 +531,6 @@ describe('CdkOption and CdkListbox', () => {
532531
it('should allow custom function to compare option values', () => {
533532
const {fixture, listbox, options} = setupComponent<ListboxWithObjectValues, {name: string}>(
534533
ListboxWithObjectValues,
535-
[CommonModule],
536534
);
537535
listbox.value = [{name: 'Banana'}];
538536
fixture.detectChanges();

src/cdk/portal/portal.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {CommonModule} from '@angular/common';
21
import {
32
AfterViewInit,
43
ApplicationRef,
@@ -24,7 +23,6 @@ describe('Portals', () => {
2423
TestBed.configureTestingModule({
2524
imports: [
2625
PortalModule,
27-
CommonModule,
2826
PortalTestApp,
2927
UnboundPortalTestApp,
3028
ArbitraryViewContainerRefComponent,
@@ -728,7 +726,7 @@ class ChocolateInjector {
728726
selector: 'pizza-msg',
729727
template: '<p>Pizza</p><p>{{snack}}</p><ng-content></ng-content>',
730728
standalone: true,
731-
imports: [PortalModule, CommonModule],
729+
imports: [PortalModule],
732730
})
733731
class PizzaMsg {
734732
snack = inject(Chocolate, {optional: true});

src/cdk/scrolling/virtual-scroll-viewport.spec.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
ScrollDispatcher,
77
ScrollingModule,
88
} from '@angular/cdk/scrolling';
9-
import {CommonModule} from '@angular/common';
109
import {
1110
ApplicationRef,
1211
Component,
@@ -1004,7 +1003,7 @@ describe('CdkVirtualScrollViewport', () => {
10041003

10051004
beforeEach(waitForAsync(() => {
10061005
TestBed.configureTestingModule({
1007-
imports: [ScrollingModule, CommonModule, DelayedInitializationVirtualScroll],
1006+
imports: [ScrollingModule, DelayedInitializationVirtualScroll],
10081007
});
10091008
fixture = TestBed.createComponent(DelayedInitializationVirtualScroll);
10101009
testComponent = fixture.componentInstance;
@@ -1034,7 +1033,7 @@ describe('CdkVirtualScrollViewport', () => {
10341033

10351034
beforeEach(waitForAsync(() => {
10361035
TestBed.configureTestingModule({
1037-
imports: [ScrollingModule, CommonModule, VirtualScrollWithAppendOnly],
1036+
imports: [ScrollingModule, VirtualScrollWithAppendOnly],
10381037
});
10391038
fixture = TestBed.createComponent(VirtualScrollWithAppendOnly);
10401039
testComponent = fixture.componentInstance;
@@ -1441,7 +1440,7 @@ class VirtualScrollWithItemInjectingViewContainer {
14411440
`,
14421441
encapsulation: ViewEncapsulation.None,
14431442
standalone: true,
1444-
imports: [ScrollingModule, CommonModule],
1443+
imports: [ScrollingModule],
14451444
})
14461445
class DelayedInitializationVirtualScroll {
14471446
@ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport;
@@ -1480,7 +1479,7 @@ class DelayedInitializationVirtualScroll {
14801479
`,
14811480
encapsulation: ViewEncapsulation.None,
14821481
standalone: true,
1483-
imports: [ScrollingModule, CommonModule],
1482+
imports: [ScrollingModule],
14841483
})
14851484
class VirtualScrollWithAppendOnly {
14861485
@ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport;

src/material-experimental/popover-edit/popover-edit.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {DataSource} from '@angular/cdk/collections';
22
import {DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, TAB, UP_ARROW} from '@angular/cdk/keycodes';
3-
import {CommonModule} from '@angular/common';
43
import {Component, Directive, ElementRef, ViewChild} from '@angular/core';
54
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
65
import {FormsModule, NgForm} from '@angular/forms';
@@ -302,7 +301,7 @@ describe('Material Popover Edit', () => {
302301

303302
beforeEach(fakeAsync(() => {
304303
TestBed.configureTestingModule({
305-
imports: [MatTableModule, MatPopoverEditModule, CommonModule, FormsModule],
304+
imports: [MatTableModule, MatPopoverEditModule, FormsModule],
306305
declarations: [componentClass],
307306
});
308307
fixture = TestBed.createComponent(componentClass);

src/material/button-toggle/button-toggle.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {dispatchMouseEvent} from '@angular/cdk/testing/private';
2-
import {CommonModule} from '@angular/common';
32
import {Component, DebugElement, QueryList, ViewChild, ViewChildren} from '@angular/core';
43
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
54
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
@@ -19,7 +18,6 @@ describe('MatButtonToggle with forms', () => {
1918
MatButtonToggleModule,
2019
FormsModule,
2120
ReactiveFormsModule,
22-
CommonModule,
2321
ButtonToggleGroupWithNgModel,
2422
ButtonToggleGroupWithFormControl,
2523
ButtonToggleGroupWithIndirectDescendantToggles,
@@ -1112,7 +1110,7 @@ class ButtonTogglesInsideButtonToggleGroup {
11121110
</mat-button-toggle-group>
11131111
`,
11141112
standalone: true,
1115-
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule, CommonModule],
1113+
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule],
11161114
})
11171115
class ButtonToggleGroupWithNgModel {
11181116
groupName = 'group-name';
@@ -1191,7 +1189,7 @@ class ButtonToggleGroupWithInitialValue {
11911189
</mat-button-toggle-group>
11921190
`,
11931191
standalone: true,
1194-
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule, CommonModule],
1192+
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule],
11951193
})
11961194
class ButtonToggleGroupWithFormControl {
11971195
control = new FormControl('');
@@ -1209,7 +1207,7 @@ class ButtonToggleGroupWithFormControl {
12091207
</mat-button-toggle-group>
12101208
`,
12111209
standalone: true,
1212-
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule, CommonModule],
1210+
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule],
12131211
})
12141212
class ButtonToggleGroupWithIndirectDescendantToggles {
12151213
control = new FormControl('');
@@ -1297,7 +1295,7 @@ class ButtonToggleWithStaticAriaAttributes {}
12971295
</mat-button-toggle-group>
12981296
`,
12991297
standalone: true,
1300-
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule, CommonModule],
1298+
imports: [MatButtonToggleModule, FormsModule, ReactiveFormsModule],
13011299
})
13021300
class ButtonToggleGroupWithFormControlAndDynamicButtons {
13031301
@ViewChildren(MatButtonToggle) toggles: QueryList<MatButtonToggle>;

src/material/chips/chip-set.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {CommonModule} from '@angular/common';
21
import {Component, DebugElement, QueryList} from '@angular/core';
32
import {ComponentFixture, TestBed, fakeAsync, tick, waitForAsync} from '@angular/core/testing';
43
import {By} from '@angular/platform-browser';
@@ -7,7 +6,7 @@ import {MatChip, MatChipSet, MatChipsModule} from './index';
76
describe('MatChipSet', () => {
87
beforeEach(waitForAsync(() => {
98
TestBed.configureTestingModule({
10-
imports: [MatChipsModule, CommonModule, BasicChipSet, IndirectDescendantsChipSet],
9+
imports: [MatChipsModule, BasicChipSet, IndirectDescendantsChipSet],
1110
});
1211
}));
1312

@@ -117,7 +116,7 @@ describe('MatChipSet', () => {
117116
</mat-chip-set>
118117
`,
119118
standalone: true,
120-
imports: [MatChipsModule, CommonModule],
119+
imports: [MatChipsModule],
121120
})
122121
class BasicChipSet {
123122
name: string = 'Test';
@@ -135,6 +134,6 @@ class BasicChipSet {
135134
</mat-chip-set>
136135
`,
137136
standalone: true,
138-
imports: [MatChipsModule, CommonModule],
137+
imports: [MatChipsModule],
139138
})
140139
class IndirectDescendantsChipSet extends BasicChipSet {}

src/material/datepicker/datepicker-actions.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {CommonModule} from '@angular/common';
21
import {Component, ElementRef, Type, ViewChild} from '@angular/core';
32
import {ComponentFixture, TestBed, fakeAsync, flush, tick} from '@angular/core/testing';
43
import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
@@ -14,7 +13,6 @@ describe('MatDatepickerActions', () => {
1413
TestBed.configureTestingModule({
1514
declarations: [component],
1615
imports: [
17-
CommonModule,
1816
FormsModule,
1917
MatDatepickerModule,
2018
MatFormFieldModule,

src/material/progress-spinner/progress-spinner.spec.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {waitForAsync, TestBed} from '@angular/core/testing';
2-
import {CommonModule} from '@angular/common';
32
import {By} from '@angular/platform-browser';
43
import {Component, ElementRef, ViewChild, ViewEncapsulation, signal} from '@angular/core';
54
import {MatProgressSpinnerModule} from './module';
@@ -10,7 +9,6 @@ describe('MatProgressSpinner', () => {
109
TestBed.configureTestingModule({
1110
imports: [
1211
MatProgressSpinnerModule,
13-
CommonModule,
1412
BasicProgressSpinner,
1513
IndeterminateProgressSpinner,
1614
ProgressSpinnerWithValueAndBoundMode,
@@ -398,14 +396,14 @@ describe('MatProgressSpinner', () => {
398396
@Component({
399397
template: '<mat-progress-spinner></mat-progress-spinner>',
400398
standalone: true,
401-
imports: [MatProgressSpinnerModule, CommonModule],
399+
imports: [MatProgressSpinnerModule],
402400
})
403401
class BasicProgressSpinner {}
404402

405403
@Component({
406404
template: '<mat-progress-spinner [strokeWidth]="strokeWidth"></mat-progress-spinner>',
407405
standalone: true,
408-
imports: [MatProgressSpinnerModule, CommonModule],
406+
imports: [MatProgressSpinnerModule],
409407
})
410408
class ProgressSpinnerCustomStrokeWidth {
411409
strokeWidth: number;
@@ -414,7 +412,7 @@ class ProgressSpinnerCustomStrokeWidth {
414412
@Component({
415413
template: '<mat-progress-spinner [diameter]="diameter"></mat-progress-spinner>',
416414
standalone: true,
417-
imports: [MatProgressSpinnerModule, CommonModule],
415+
imports: [MatProgressSpinnerModule],
418416
})
419417
class ProgressSpinnerCustomDiameter {
420418
diameter: number;
@@ -423,14 +421,14 @@ class ProgressSpinnerCustomDiameter {
423421
@Component({
424422
template: '<mat-progress-spinner mode="indeterminate"></mat-progress-spinner>',
425423
standalone: true,
426-
imports: [MatProgressSpinnerModule, CommonModule],
424+
imports: [MatProgressSpinnerModule],
427425
})
428426
class IndeterminateProgressSpinner {}
429427

430428
@Component({
431429
template: '<mat-progress-spinner [value]="value()" [mode]="mode()"></mat-progress-spinner>',
432430
standalone: true,
433-
imports: [MatProgressSpinnerModule, CommonModule],
431+
imports: [MatProgressSpinnerModule],
434432
})
435433
class ProgressSpinnerWithValueAndBoundMode {
436434
mode = signal('indeterminate');
@@ -441,7 +439,7 @@ class ProgressSpinnerWithValueAndBoundMode {
441439
template: `
442440
<mat-spinner [color]="color()"></mat-spinner>`,
443441
standalone: true,
444-
imports: [MatProgressSpinnerModule, CommonModule],
442+
imports: [MatProgressSpinnerModule],
445443
})
446444
class SpinnerWithColor {
447445
color = signal('primary');
@@ -451,7 +449,7 @@ class SpinnerWithColor {
451449
template: `
452450
<mat-progress-spinner value="50" [color]="color()"></mat-progress-spinner>`,
453451
standalone: true,
454-
imports: [MatProgressSpinnerModule, CommonModule],
452+
imports: [MatProgressSpinnerModule],
455453
})
456454
class ProgressSpinnerWithColor {
457455
color = signal('primary');
@@ -462,7 +460,7 @@ class ProgressSpinnerWithColor {
462460
<mat-progress-spinner value="25" diameter="37" strokeWidth="11"></mat-progress-spinner>
463461
`,
464462
standalone: true,
465-
imports: [MatProgressSpinnerModule, CommonModule],
463+
imports: [MatProgressSpinnerModule],
466464
})
467465
class ProgressSpinnerWithStringValues {}
468466

@@ -472,7 +470,7 @@ class ProgressSpinnerWithStringValues {}
472470
`,
473471
encapsulation: ViewEncapsulation.ShadowDom,
474472
standalone: true,
475-
imports: [MatProgressSpinnerModule, CommonModule],
473+
imports: [MatProgressSpinnerModule],
476474
})
477475
class IndeterminateSpinnerInShadowDom {
478476
diameter: number;
@@ -488,7 +486,7 @@ class IndeterminateSpinnerInShadowDom {
488486
`,
489487
encapsulation: ViewEncapsulation.ShadowDom,
490488
standalone: true,
491-
imports: [MatProgressSpinnerModule, CommonModule],
489+
imports: [MatProgressSpinnerModule],
492490
})
493491
class IndeterminateSpinnerInShadowDomWithNgIf {
494492
@ViewChild(MatProgressSpinner, {read: ElementRef})
@@ -500,6 +498,6 @@ class IndeterminateSpinnerInShadowDomWithNgIf {
500498
@Component({
501499
template: '<mat-spinner mode="determinate"></mat-spinner>',
502500
standalone: true,
503-
imports: [MatProgressSpinnerModule, CommonModule],
501+
imports: [MatProgressSpinnerModule],
504502
})
505503
class SpinnerWithMode {}

0 commit comments

Comments
 (0)