Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
bf2e6d0
test(material/datepicker): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
9f40d5e
test(material/divider): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
f7eeecd
test(material/expansion): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
e4d2ebd
test(material/form-field): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
192f071
test(material/menu): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
4dbe164
test(material/list): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
414290c
test(material/progress-bar): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
caaf4cb
test(material/progress-spinner): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
f6e8dc4
test(material/radio): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
70f6238
test(material/sidenav): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
ead30fe
test(material/slide-toggle): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
14d397b
test(material/snack-bar): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
67afd7a
test(material/sort): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
8ee5d3c
test(material/table): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
95c7ae9
test(material/tabs): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
80ffba4
test(material/toolbar): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
eb6b8d4
test(material/tooltip): clean up unnecessary imports in tests
crisbeto Aug 22, 2025
498f1f6
test(material/tree): clean up unnecessary imports in tests
crisbeto Aug 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/material-experimental/menubar/menubar-item.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component, ElementRef, ViewChild} from '@angular/core';
import {ComponentFixture, waitForAsync, TestBed} from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {CdkMenuItem, CdkMenuModule, CdkMenu} from '@angular/cdk/menu';
import {MatMenuBarItem} from './menubar-item';
import {MatMenuBarModule} from './menubar-module';
Expand All @@ -8,12 +8,6 @@ describe('MatMenuBarItem', () => {
let fixture: ComponentFixture<SimpleMenuBarItem>;
let nativeMenubarItem: HTMLElement;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatMenuBarModule, CdkMenuModule, SimpleMenuBarItem],
});
}));

beforeEach(() => {
fixture = TestBed.createComponent(SimpleMenuBarItem);
fixture.detectChanges();
Expand Down
8 changes: 1 addition & 7 deletions src/material-experimental/menubar/menubar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component, ViewChild, ElementRef} from '@angular/core';
import {RIGHT_ARROW} from '@angular/cdk/keycodes';
import {CdkMenuBar} from '@angular/cdk/menu';
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {dispatchKeyboardEvent} from '../../cdk/testing/private';
import {MatMenuBarModule} from './menubar-module';
import {MatMenuBar} from './menubar';
Expand All @@ -10,12 +10,6 @@ describe('MatMenuBar', () => {
let fixture: ComponentFixture<SimpleMatMenuBar>;
let nativeMatMenubar: HTMLElement;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatMenuBarModule, SimpleMatMenuBar],
});
}));

beforeEach(() => {
fixture = TestBed.createComponent(SimpleMatMenuBar);
fixture.detectChanges();
Expand Down
8 changes: 1 addition & 7 deletions src/material/datepicker/calendar-body.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ import {
dispatchTouchEvent,
} from '@angular/cdk/testing/private';
import {Component} from '@angular/core';
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {MatCalendarBody, MatCalendarCell, MatCalendarUserEvent} from './calendar-body';

describe('MatCalendarBody', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatCalendarBody, StandardCalendarBody, RangeCalendarBody],
});
}));

describe('standard calendar body', () => {
let fixture: ComponentFixture<StandardCalendarBody>;
let testComponent: StandardCalendarBody;
Expand Down
8 changes: 1 addition & 7 deletions src/material/datepicker/calendar-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ import {yearsPerPage} from './multi-year-view';
describe('MatCalendarHeader', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
MatNativeDateModule,
MatDatepickerModule,
// Test components.
StandardCalendar,
CalendarWithMinMaxDate,
],
imports: [MatNativeDateModule, MatDatepickerModule],
providers: [MatDatepickerIntl, provideFakeDirectionality('ltr')],
});
}));
Expand Down
22 changes: 3 additions & 19 deletions src/material/datepicker/month-view.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {MAT_DATE_FORMATS, MatNativeDateModule} from '../core';
import {DEC, FEB, JAN, MAR, NOV} from '../testing';
import {MatCalendarBody, MatCalendarUserEvent} from './calendar-body';
import {MatCalendarUserEvent} from './calendar-body';
import {
DefaultMatCalendarRangeStrategy,
MAT_DATE_RANGE_SELECTION_STRATEGY,
Expand All @@ -41,15 +41,7 @@ describe('MatMonthView', () => {
dir = signal<Direction>('ltr');

TestBed.configureTestingModule({
imports: [
MatNativeDateModule,
MatCalendarBody,
MatMonthView,
// Test components.
StandardMonthView,
MonthViewWithDateFilter,
MonthViewWithDateClass,
],
imports: [MatNativeDateModule],
providers: [
provideFakeDirectionality(dir),
{provide: MAT_DATE_RANGE_SELECTION_STRATEGY, useClass: DefaultMatCalendarRangeStrategy},
Expand Down Expand Up @@ -806,15 +798,7 @@ describe('MatMonthView', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
MatNativeDateModule,
MatCalendarBody,
MatMonthView,
// Test components.
StandardMonthView,
MonthViewWithDateFilter,
MonthViewWithDateClass,
],
imports: [MatNativeDateModule],
providers: [
provideFakeDirectionality('ltr'),
{provide: MAT_DATE_RANGE_SELECTION_STRATEGY, useClass: DefaultMatCalendarRangeStrategy},
Expand Down
12 changes: 1 addition & 11 deletions src/material/datepicker/multi-year-view.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {MatNativeDateModule} from '../core';
import {JAN, MAR} from '../testing';
import {MatCalendarBody} from './calendar-body';
import {MatMultiYearView, yearsPerPage, yearsPerRow} from './multi-year-view';

describe('MatMultiYearView', () => {
Expand All @@ -29,16 +28,7 @@ describe('MatMultiYearView', () => {
dir = signal<Direction>('ltr');

TestBed.configureTestingModule({
imports: [
MatNativeDateModule,
MatCalendarBody,
MatMultiYearView,
// Test components.
StandardMultiYearView,
MultiYearViewWithDateFilter,
MultiYearViewWithMinMaxDate,
MultiYearViewWithDateClass,
],
imports: [MatNativeDateModule],
providers: [provideFakeDirectionality(dir)],
});
}));
Expand Down
2 changes: 1 addition & 1 deletion src/material/datepicker/testing/calendar-harness.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('MatCalendarHarness', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [MatNativeDateModule, MatDatepickerModule, CalendarHarnessTest],
imports: [MatNativeDateModule],
providers: [
{
// Usually it's the date range picker that provides the default range selection strategy,
Expand Down
11 changes: 1 addition & 10 deletions src/material/datepicker/year-view.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {MatNativeDateModule} from '../core';
import {AUG, DEC, FEB, JAN, JUL, JUN, MAR, MAY, NOV, OCT, SEP} from '../testing';
import {MatCalendarBody} from './calendar-body';
import {MatYearView} from './year-view';

describe('MatYearView', () => {
Expand All @@ -29,15 +28,7 @@ describe('MatYearView', () => {
dir = signal<Direction>('ltr');

TestBed.configureTestingModule({
imports: [
MatNativeDateModule,
MatCalendarBody,
MatYearView,
// Test components.
StandardYearView,
YearViewWithDateFilter,
YearViewWithDateClass,
],
imports: [MatNativeDateModule],
providers: [provideFakeDirectionality(dir)],
});
}));
Expand Down
4 changes: 0 additions & 4 deletions src/material/divider/divider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ describe('MatDivider', () => {
let fixture: ComponentFixture<MatDividerTestComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [MatDividerModule, MatDividerTestComponent],
});

fixture = TestBed.createComponent(MatDividerTestComponent);
});

Expand Down
4 changes: 0 additions & 4 deletions src/material/divider/testing/divider-harness.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ describe('MatLegacyButtonHarness', () => {
let loader: HarnessLoader;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [MatDividerModule, DividerHarnessTest],
});

fixture = TestBed.createComponent(DividerHarnessTest);
fixture.detectChanges();
loader = TestbedHarnessEnvironment.loader(fixture);
Expand Down
11 changes: 0 additions & 11 deletions src/material/expansion/expansion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ import {MATERIAL_ANIMATIONS} from '../core';
describe('MatExpansionPanel', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
MatExpansionModule,
PanelWithContent,
PanelWithContentInNgIf,
PanelWithCustomMargin,
LazyPanelWithContent,
LazyPanelOpenOnLoad,
PanelWithTwoWayBinding,
PanelWithHeaderTabindex,
NestedLazyPanelWithContent,
],
providers: [
{
provide: MATERIAL_ANIMATIONS,
Expand Down
26 changes: 1 addition & 25 deletions src/material/list/list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
import {dispatchFakeEvent, dispatchMouseEvent} from '@angular/cdk/testing/private';
import {Component, QueryList, ViewChild, ViewChildren} from '@angular/core';
import {TestBed, fakeAsync, waitForAsync} from '@angular/core/testing';
import {TestBed, fakeAsync} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {MatListItem, MatListModule} from './index';

describe('MatList', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
MatListModule,
ListWithOneAnchorItem,
ListWithOneItem,
ListWithTwoLineItem,
ListWithThreeLineItem,
ListWithAvatar,
ListWithItemWithCssClass,
ListWithDynamicNumberOfLines,
ListWithMultipleItems,
NavListWithOneAnchorItem,
NavListWithActivatedItem,
ActionListWithoutType,
ActionListWithType,
ActionListWithDisabledList,
ActionListWithDisabledItem,
ListWithDisabledItems,
StandaloneListItem,
],
});
}));

it('should apply an additional class to lists without lines', () => {
const fixture = TestBed.createComponent(ListWithOneItem);
const listItem = fixture.debugElement.query(By.css('mat-list-item'))!;
Expand Down
68 changes: 0 additions & 68 deletions src/material/list/selection-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,12 +691,6 @@ describe('MatSelectionList without forms', () => {
let listOptionElements: DebugElement[];
let selectionList: DebugElement;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatListModule, SelectionListWithSelectedOption],
});
}));

beforeEach(waitForAsync(() => {
fixture = TestBed.createComponent(SelectionListWithSelectedOption);
listOptionElements = fixture.debugElement.queryAll(By.directive(MatListOption))!;
Expand Down Expand Up @@ -727,12 +721,6 @@ describe('MatSelectionList without forms', () => {
let fixture: ComponentFixture<SingleSelectionListWithSelectedOption>;
let listOptionElements: DebugElement[];

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatListModule, SingleSelectionListWithSelectedOption],
});
}));

beforeEach(waitForAsync(() => {
fixture = TestBed.createComponent(SingleSelectionListWithSelectedOption);
listOptionElements = fixture.debugElement.queryAll(By.directive(MatListOption))!;
Expand Down Expand Up @@ -764,7 +752,6 @@ describe('MatSelectionList without forms', () => {
const matListConfig: MatListConfig = {hideSingleSelectionIndicator: true};

TestBed.configureTestingModule({
imports: [MatListModule, SingleSelectionListWithSelectedOption],
providers: [{provide: MAT_LIST_CONFIG, useValue: matListConfig}],
});
}));
Expand Down Expand Up @@ -795,12 +782,6 @@ describe('MatSelectionList without forms', () => {
let listOptionEl: HTMLElement;
let listOption: MatListOption;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatListModule, SelectionListWithDisabledOption],
});
}));

beforeEach(waitForAsync(() => {
fixture = TestBed.createComponent(SelectionListWithDisabledOption);

Expand Down Expand Up @@ -842,18 +823,6 @@ describe('MatSelectionList without forms', () => {
let listOption: DebugElement[];
let selectionList: DebugElement;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
MatListModule,
SelectionListWithListOptions,
SelectionListWithCheckboxPositionAfter,
SelectionListWithListDisabled,
SelectionListWithOnlyOneOption,
],
});
}));

beforeEach(waitForAsync(() => {
fixture = TestBed.createComponent(SelectionListWithListDisabled);
listOption = fixture.debugElement.queryAll(By.directive(MatListOption));
Expand Down Expand Up @@ -941,18 +910,6 @@ describe('MatSelectionList without forms', () => {
describe('with checkbox position after', () => {
let fixture: ComponentFixture<SelectionListWithCheckboxPositionAfter>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
MatListModule,
SelectionListWithListOptions,
SelectionListWithCheckboxPositionAfter,
SelectionListWithListDisabled,
SelectionListWithOnlyOneOption,
],
});
}));

beforeEach(waitForAsync(() => {
fixture = TestBed.createComponent(SelectionListWithCheckboxPositionAfter);
fixture.detectChanges();
Expand All @@ -969,12 +926,6 @@ describe('MatSelectionList without forms', () => {
});

describe('with list item elements', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatListModule, SelectionListWithAvatar, SelectionListWithIcon],
});
}));

function expectCheckboxAtPosition(
listItemElement: HTMLElement,
position: MatListOptionTogglePosition,
Expand Down Expand Up @@ -1102,10 +1053,6 @@ describe('MatSelectionList without forms', () => {
let selectionList: DebugElement;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatListModule, SelectionListWithListOptions],
});

fixture = TestBed.createComponent(SelectionListWithListOptions);
fixture.componentInstance.multiple = false;
fixture.changeDetectorRef.markForCheck();
Expand Down Expand Up @@ -1228,10 +1175,6 @@ describe('MatSelectionList without forms', () => {
let option: MatListOption;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatListModule, ListOptionWithTwoWayBinding],
});

fixture = TestBed.createComponent(ListOptionWithTwoWayBinding);
fixture.detectChanges();
const optionDebug = fixture.debugElement.query(By.directive(MatListOption));
Expand Down Expand Up @@ -1857,17 +1800,6 @@ class SelectionListWithSelectedOptionAndValue {
itemValue = 'item1';
}

@Component({
template: `
<mat-selection-list id="selection-list-4">
<mat-list-option togglePosition="after" class="test-focus" id="123">
Inbox
</mat-list-option>
</mat-selection-list>`,
imports: [MatListModule],
})
class SelectionListWithOnlyOneOption {}

@Component({
template: `
<mat-selection-list
Expand Down
Loading
Loading