Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
import {MatDatepickerInputHarness} from '@angular/material/datepicker/testing';
import {HarnessLoader} from '@angular/cdk/testing';
import {DatepickerHarnessExample} from './datepicker-harness-example';
import {MATERIAL_ANIMATIONS, MatNativeDateModule} from '@angular/material/core';
import {MATERIAL_ANIMATIONS, provideNativeDateAdapter} from '@angular/material/core';

describe('DatepickerHarnessExample', () => {
let fixture: ComponentFixture<DatepickerHarnessExample>;
let loader: HarnessLoader;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [MatNativeDateModule],
providers: [{provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}}],
providers: [
provideNativeDateAdapter(),
{provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}},
],
});
fixture = TestBed.createComponent(DatepickerHarnessExample);
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
import {MatTimepickerInputHarness} from '@angular/material/timepicker/testing';
import {HarnessLoader} from '@angular/cdk/testing';
import {TimepickerHarnessExample} from './timepicker-harness-example';
import {DateAdapter, MATERIAL_ANIMATIONS, MatNativeDateModule} from '@angular/material/core';
import {DateAdapter, MATERIAL_ANIMATIONS, provideNativeDateAdapter} from '@angular/material/core';

describe('TimepickerHarnessExample', () => {
let fixture: ComponentFixture<TimepickerHarnessExample>;
let loader: HarnessLoader;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [MatNativeDateModule],
providers: [{provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}}],
providers: [
provideNativeDateAdapter(),
{provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}},
],
});
TestBed.inject(DateAdapter).setLocale('en-US'); // Set the locale to en-US to guarantee consistent tests.
fixture = TestBed.createComponent(TimepickerHarnessExample);
Expand Down
10 changes: 5 additions & 5 deletions src/material/datepicker/calendar-header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {provideFakeDirectionality} from '@angular/cdk/testing/private';
import {Component} from '@angular/core';
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {DateAdapter, MatNativeDateModule} from '../core';
import {DateAdapter, provideNativeDateAdapter} from '../core';
import {DEC, FEB, JAN} from '../testing';
import {MatCalendar} from './calendar';
import {MatDatepickerIntl} from './datepicker-intl';
Expand All @@ -12,8 +12,8 @@ import {yearsPerPage} from './multi-year-view';
describe('MatCalendarHeader', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatNativeDateModule, MatDatepickerModule],
providers: [MatDatepickerIntl, provideFakeDirectionality('ltr')],
imports: [MatDatepickerModule],
providers: [MatDatepickerIntl, provideFakeDirectionality('ltr'), provideNativeDateAdapter()],
});
}));

Expand Down Expand Up @@ -378,7 +378,7 @@ describe('MatCalendarHeader', () => {
(yearSelected)="selectedYear=$event"
(monthSelected)="selectedMonth=$event">
</mat-calendar>`,
imports: [MatNativeDateModule, MatDatepickerModule],
imports: [MatDatepickerModule],
})
class StandardCalendar {
selected: Date;
Expand All @@ -395,7 +395,7 @@ class StandardCalendar {
[maxDate]="maxDate">
</mat-calendar>
`,
imports: [MatNativeDateModule, MatDatepickerModule],
imports: [MatDatepickerModule],
})
class CalendarWithMinMaxDate {
startAt = new Date(2018, JAN, 1);
Expand Down
4 changes: 2 additions & 2 deletions src/material/datepicker/date-range-input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
Validators,
} from '@angular/forms';
import {Subscription} from 'rxjs';
import {ErrorStateMatcher, MATERIAL_ANIMATIONS, MatNativeDateModule} from '../core';
import {ErrorStateMatcher, MATERIAL_ANIMATIONS, provideNativeDateAdapter} from '../core';
import {MatFormField, MatFormFieldModule, MatLabel} from '../form-field';
import {MatInputModule} from '../input';
import {MatDateRangeInput} from './date-range-input';
Expand All @@ -36,11 +36,11 @@ describe('MatDateRangeInput', () => {
MatFormFieldModule,
MatInputModule,
ReactiveFormsModule,
MatNativeDateModule,
component,
],
providers: [
...providers,
provideNativeDateAdapter(),
{provide: MATERIAL_ANIMATIONS, useValue: {animationsDisabled: true}},
],
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {TestBed} from '@angular/core/testing';
import {MatNativeDateModule} from '../core';
import {provideNativeDateAdapter} from '../core';

import {JAN, FEB, MAR} from '../testing';
import {
Expand All @@ -13,8 +13,8 @@ describe('DefaultMatCalendarRangeStrategy', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [MatNativeDateModule],
providers: [
provideNativeDateAdapter(),
{provide: MAT_DATE_RANGE_SELECTION_STRATEGY, useClass: DefaultMatCalendarRangeStrategy},
],
});
Expand Down
Loading
Loading