Skip to content

Commit 4718718

Browse files
authored
test: remove compileComponent calls (#29535)
Calls to `compileComponent` aren't necessary in the vast majority of cases. These changes clean them up frm our codebase.
1 parent 78c6941 commit 4718718

File tree

187 files changed

+438
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+438
-625
lines changed

src/cdk-experimental/combobox/combobox.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('Combobox', () => {
2626
beforeEach(waitForAsync(() => {
2727
TestBed.configureTestingModule({
2828
imports: [CdkComboboxModule, ComboboxToggle],
29-
}).compileComponents();
29+
});
3030
}));
3131

3232
beforeEach(() => {
@@ -192,7 +192,7 @@ describe('Combobox', () => {
192192
beforeEach(waitForAsync(() => {
193193
TestBed.configureTestingModule({
194194
imports: [CdkComboboxModule, ComboboxToggle],
195-
}).compileComponents();
195+
});
196196
}));
197197

198198
beforeEach(() => {
@@ -262,7 +262,7 @@ describe('Combobox', () => {
262262
beforeEach(waitForAsync(() => {
263263
TestBed.configureTestingModule({
264264
imports: [CdkComboboxModule, ComboboxToggle],
265-
}).compileComponents();
265+
});
266266
}));
267267

268268
beforeEach(() => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ describe('CDK Popover Edit', () => {
397397
TestBed.configureTestingModule({
398398
imports: [CdkTableModule, CdkPopoverEditModule, CommonModule, FormsModule, BidiModule],
399399
declarations: [componentClass],
400-
}).compileComponents();
400+
});
401401
fixture = TestBed.createComponent<BaseTestComponent>(componentClass);
402402
component = fixture.componentInstance;
403403
fixture.detectChanges();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('CdkVirtualScrollViewport', () => {
1212
beforeEach(waitForAsync(() => {
1313
TestBed.configureTestingModule({
1414
imports: [ScrollingModule, ExperimentalScrollingModule, AutoSizeVirtualScroll],
15-
}).compileComponents();
15+
});
1616
}));
1717

1818
beforeEach(() => {

src/cdk-experimental/selection/selection.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('CdkSelection', () => {
1414
beforeEach(waitForAsync(() => {
1515
TestBed.configureTestingModule({
1616
imports: [CdkSelectionModule, ListWithMultiSelection],
17-
}).compileComponents();
17+
});
1818
}));
1919

2020
beforeEach(() => {
@@ -240,7 +240,7 @@ describe('CdkSelection with multiple = false', () => {
240240
beforeEach(waitForAsync(() => {
241241
TestBed.configureTestingModule({
242242
imports: [CdkSelectionModule, ListWithSingleSelection],
243-
}).compileComponents();
243+
});
244244
}));
245245

246246
beforeEach(() => {
@@ -305,7 +305,7 @@ describe('cdkSelectionColumn', () => {
305305
beforeEach(waitForAsync(() => {
306306
TestBed.configureTestingModule({
307307
imports: [CdkSelectionModule, CdkTableModule, MultiSelectTableWithSelectionColumn],
308-
}).compileComponents();
308+
});
309309
}));
310310

311311
beforeEach(() => {
@@ -399,7 +399,7 @@ describe('cdkSelectionColumn with multiple = false', () => {
399399
beforeEach(waitForAsync(() => {
400400
TestBed.configureTestingModule({
401401
imports: [CdkSelectionModule, CdkTableModule, SingleSelectTableWithSelectionColumn],
402-
}).compileComponents();
402+
});
403403
}));
404404

405405
beforeEach(() => {

src/cdk-experimental/table-scroll-container/table-scroll-container.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('CdkTableScrollContainer', () => {
2424
): ComponentFixture<T> {
2525
TestBed.configureTestingModule({
2626
imports: [CdkTableModule, CdkTableScrollContainerModule, componentType, ...declarations],
27-
}).compileComponents();
27+
});
2828

2929
return TestBed.createComponent<T>(componentType);
3030
}

src/cdk/a11y/aria-describer/aria-describer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('AriaDescriber', () => {
1212
TestBed.configureTestingModule({
1313
imports: [A11yModule, TestApp],
1414
providers: [AriaDescriber, ...providers],
15-
}).compileComponents();
15+
});
1616

1717
fixture = TestBed.createComponent(TestApp);
1818
component = fixture.componentInstance;

src/cdk/a11y/focus-monitor/focus-monitor.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('FocusMonitor', () => {
5959
},
6060
},
6161
],
62-
}).compileComponents();
62+
});
6363
});
6464

6565
beforeEach(inject([FocusMonitor], (fm: FocusMonitor) => {
@@ -478,7 +478,7 @@ describe('FocusMonitor with "eventual" detection', () => {
478478
},
479479
},
480480
],
481-
}).compileComponents();
481+
});
482482
});
483483

484484
beforeEach(inject([FocusMonitor], (fm: FocusMonitor) => {
@@ -515,7 +515,7 @@ describe('cdkMonitorFocus', () => {
515515
FocusMonitorOnCommentNode,
516516
ExportedFocusMonitor,
517517
],
518-
}).compileComponents();
518+
});
519519
});
520520

521521
describe('button with cdkMonitorElementFocus', () => {
@@ -827,7 +827,7 @@ describe('FocusMonitor observable stream', () => {
827827
TestBed.configureTestingModule({
828828
imports: [A11yModule, PlainButton],
829829
providers: [{provide: Platform, useValue: fakePlatform}],
830-
}).compileComponents();
830+
});
831831
});
832832

833833
beforeEach(inject([FocusMonitor], (fm: FocusMonitor) => {
@@ -864,7 +864,7 @@ describe('FocusMonitor input label detection', () => {
864864
beforeEach(() => {
865865
TestBed.configureTestingModule({
866866
imports: [A11yModule, CheckboxWithLabel],
867-
}).compileComponents();
867+
});
868868
});
869869

870870
beforeEach(inject([FocusMonitor], (fm: FocusMonitor) => {

src/cdk/a11y/focus-monitor/focus-monitor.zone.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('FocusMonitor observable stream Zone.js integration', () => {
1616
TestBed.configureTestingModule({
1717
imports: [A11yModule, PlainButton],
1818
providers: [{provide: Platform, useValue: fakePlatform}, provideZoneChangeDetection()],
19-
}).compileComponents();
19+
});
2020
});
2121

2222
beforeEach(inject([FocusMonitor], (fm: FocusMonitor) => {

src/cdk/a11y/focus-trap/configurable-focus-trap.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function createComponent<T>(
9595
TestBed.configureTestingModule({
9696
imports: [A11yModule, componentType],
9797
providers: providers,
98-
}).compileComponents();
98+
});
9999

100100
return TestBed.createComponent<T>(componentType);
101101
}

src/cdk/a11y/focus-trap/event-listener-inert-strategy.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function createComponent<T>(
6464
TestBed.configureTestingModule({
6565
imports: [A11yModule, componentType],
6666
providers: providers,
67-
}).compileComponents();
67+
});
6868

6969
return TestBed.createComponent<T>(componentType);
7070
}

src/cdk/a11y/focus-trap/focus-trap.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ describe('FocusTrap', () => {
2828
FocusTrapWithAutoCaptureInShadowDom,
2929
],
3030
});
31-
32-
TestBed.compileComponents();
3331
}));
3432

3533
describe('with default element', () => {

src/cdk/accordion/accordion-item.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ describe('CdkAccordionItem', () => {
1515
ItemGroupWithAccordion,
1616
],
1717
});
18-
TestBed.compileComponents();
1918
}));
2019

2120
describe('single item', () => {

src/cdk/accordion/accordion.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ describe('CdkAccordion', () => {
1111
TestBed.configureTestingModule({
1212
imports: [BrowserAnimationsModule, CdkAccordionModule, SetOfItems, NestedItems],
1313
});
14-
TestBed.compileComponents();
1514
}));
1615

1716
it('should ensure only one item is expanded at a time', () => {

src/cdk/bidi/directionality.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('Directionality', () => {
1818
ElementWithPredefinedUppercaseDir,
1919
],
2020
providers: [{provide: DIR_DOCUMENT, useFactory: () => fakeDocument}],
21-
}).compileComponents();
21+
});
2222
}));
2323

2424
describe('Service', () => {

src/cdk/clipboard/copy-to-clipboard.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ describe('CdkCopyToClipboard', () => {
3131
TestBed.configureTestingModule({
3232
imports: [ClipboardModule, CopyToClipboardHost],
3333
});
34-
35-
TestBed.compileComponents();
3634
}));
3735

3836
beforeEach(() => {

src/cdk/dialog/dialog.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ describe('Dialog', () => {
6969
],
7070
});
7171

72-
TestBed.compileComponents();
73-
7472
dialog = TestBed.inject(Dialog);
7573
mockLocation = TestBed.inject(Location) as SpyLocation;
7674
overlay = TestBed.inject(Overlay);
@@ -1131,7 +1129,6 @@ describe('Dialog with a parent Dialog', () => {
11311129
],
11321130
});
11331131

1134-
TestBed.compileComponents();
11351132
parentDialog = TestBed.inject(Dialog);
11361133
fixture = TestBed.createComponent(ComponentThatProvidesMatDialog);
11371134
childDialog = fixture.componentInstance.dialog;

src/cdk/drag-drop/directives/test-utils.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export function createComponent<T>(
4646
});
4747
}
4848

49-
TestBed.compileComponents();
5049
return TestBed.createComponent<T>(componentType);
5150
}
5251

src/cdk/drag-drop/drag-drop-registry.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('DragDropRegistry', () => {
1818
beforeEach(fakeAsync(() => {
1919
TestBed.configureTestingModule({
2020
imports: [DragDropModule, BlankComponent],
21-
}).compileComponents();
21+
});
2222

2323
fixture = TestBed.createComponent(BlankComponent);
2424
fixture.detectChanges();

src/cdk/drag-drop/drag-drop.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ describe('DragDrop', () => {
1313
imports: [DragDropModule, TestComponent],
1414
});
1515

16-
TestBed.compileComponents();
1716
service = TestBed.inject(DragDrop);
1817
}));
1918

src/cdk/listbox/listbox.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function setupComponent<T, O = string>(component: Type<T>, imports: any[] = [])
2121
TestBed.configureTestingModule({
2222
imports: [CdkListboxModule, ...imports],
2323
declarations: [component],
24-
}).compileComponents();
24+
});
2525
const fixture = TestBed.createComponent(component);
2626
fixture.detectChanges();
2727

src/cdk/menu/context-menu-trigger.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('CdkContextMenuTrigger', () => {
1818
TestBed.configureTestingModule({
1919
imports: [CdkMenuModule],
2020
declarations: [SimpleContextMenu],
21-
}).compileComponents();
21+
});
2222
}));
2323

2424
beforeEach(() => {
@@ -152,7 +152,7 @@ describe('CdkContextMenuTrigger', () => {
152152
TestBed.configureTestingModule({
153153
imports: [CdkMenuModule],
154154
declarations: [NestedContextMenu],
155-
}).compileComponents();
155+
});
156156
}));
157157

158158
beforeEach(() => {
@@ -267,7 +267,7 @@ describe('CdkContextMenuTrigger', () => {
267267
TestBed.configureTestingModule({
268268
imports: [CdkMenuModule],
269269
declarations: [ContextMenuWithSubmenu],
270-
}).compileComponents();
270+
});
271271
}));
272272

273273
beforeEach(() => {
@@ -298,7 +298,7 @@ describe('CdkContextMenuTrigger', () => {
298298
TestBed.configureTestingModule({
299299
imports: [CdkMenuModule],
300300
declarations: [ContextMenuWithMenuBarAndInlineMenu],
301-
}).compileComponents();
301+
});
302302
}));
303303

304304
beforeEach(() => {
@@ -402,7 +402,7 @@ describe('CdkContextMenuTrigger', () => {
402402
TestBed.configureTestingModule({
403403
imports: [CdkMenuModule],
404404
declarations: [componentClass],
405-
}).compileComponents();
405+
});
406406

407407
const fixture = TestBed.createComponent(componentClass);
408408
fixture.detectChanges();
@@ -428,7 +428,7 @@ describe('CdkContextMenuTrigger', () => {
428428
TestBed.configureTestingModule({
429429
imports: [CdkMenuModule],
430430
declarations: [ContextTriggerWithData],
431-
}).compileComponents();
431+
});
432432

433433
const fixture = TestBed.createComponent(ContextTriggerWithData);
434434
fixture.componentInstance.menuData = {message: 'Hello!'};

src/cdk/menu/menu-bar.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('MenuBar', () => {
4747
beforeEach(waitForAsync(() => {
4848
TestBed.configureTestingModule({
4949
imports: [CdkMenuModule, MenuBarRadioGroup],
50-
}).compileComponents();
50+
});
5151

5252
fixture = TestBed.createComponent(MenuBarRadioGroup);
5353
fixture.detectChanges();
@@ -107,7 +107,7 @@ describe('MenuBar', () => {
107107
beforeEach(waitForAsync(() => {
108108
TestBed.configureTestingModule({
109109
imports: [CdkMenuModule, MultiMenuWithSubmenu],
110-
}).compileComponents();
110+
});
111111
}));
112112

113113
beforeEach(() => {
@@ -531,7 +531,7 @@ describe('MenuBar', () => {
531531
beforeEach(waitForAsync(() => {
532532
TestBed.configureTestingModule({
533533
imports: [CdkMenuModule, MultiMenuWithSubmenu],
534-
}).compileComponents();
534+
});
535535
}));
536536

537537
beforeEach(() => {
@@ -658,7 +658,7 @@ describe('MenuBar', () => {
658658
beforeEach(waitForAsync(() => {
659659
TestBed.configureTestingModule({
660660
imports: [CdkMenuModule, MenuWithCheckboxes],
661-
}).compileComponents();
661+
});
662662
}));
663663

664664
beforeEach(() => {
@@ -724,7 +724,7 @@ describe('MenuBar', () => {
724724
beforeEach(waitForAsync(() => {
725725
TestBed.configureTestingModule({
726726
imports: [CdkMenuModule, MenuWithRadioButtons],
727-
}).compileComponents();
727+
});
728728
}));
729729

730730
beforeEach(() => {
@@ -779,7 +779,7 @@ describe('MenuBar', () => {
779779
beforeEach(waitForAsync(() => {
780780
TestBed.configureTestingModule({
781781
imports: [CdkMenuModule, MenuBarWithMenusAndInlineMenu],
782-
}).compileComponents();
782+
});
783783
}));
784784

785785
beforeEach(() => {
@@ -898,7 +898,7 @@ describe('MenuBar', () => {
898898
beforeEach(waitForAsync(() => {
899899
TestBed.configureTestingModule({
900900
imports: [CdkMenuModule, MultiMenuWithSubmenu],
901-
}).compileComponents();
901+
});
902902
}));
903903

904904
beforeEach(() => {

src/cdk/menu/menu-group.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('MenuGroup', () => {
1414
beforeEach(waitForAsync(() => {
1515
TestBed.configureTestingModule({
1616
imports: [CdkMenuModule, CheckboxMenu],
17-
}).compileComponents();
17+
});
1818

1919
fixture = TestBed.createComponent(CheckboxMenu);
2020
fixture.detectChanges();
@@ -41,7 +41,7 @@ describe('MenuGroup', () => {
4141
beforeEach(waitForAsync(() => {
4242
TestBed.configureTestingModule({
4343
imports: [CdkMenuModule, MenuWithMultipleRadioGroups],
44-
}).compileComponents();
44+
});
4545

4646
fixture = TestBed.createComponent(MenuWithMultipleRadioGroups);
4747
fixture.detectChanges();

0 commit comments

Comments
 (0)