Skip to content

Commit 0b011aa

Browse files
committed
test: Fix date constants for the Angular 11
1 parent 2c9224f commit 0b011aa

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

projects/ngx-mat-datefns-date-adapter/src/lib/ngx-mat-datefns-date-adapter.spec.ts

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { LOCALE_ID } from '@angular/core';
2-
import { async, inject, TestBed } from '@angular/core/testing';
3-
import {
4-
DateAdapter,
5-
DEC,
6-
FEB,
7-
JAN,
8-
MAR,
9-
MAT_DATE_LOCALE,
10-
} from '@angular/material/core';
2+
import { inject, TestBed, waitForAsync } from '@angular/core/testing';
3+
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
114
import { NgxDateFnsDateAdapter } from './ngx-mat-datefns-date-adapter';
125
import { NgxMatDateFnsDateModule } from './ngx-mat-datefns-date-adapter.module';
136

7+
const JAN = 0,
8+
FEB = 1,
9+
MAR = 2,
10+
DEC = 11;
11+
1412
describe('NgxDateFnsDateAdapter', () => {
1513
let adapter: NgxDateFnsDateAdapter;
1614
let assertValidDate: (d: Date | null, valid: boolean) => void;
1715

18-
beforeEach(async(() => {
19-
TestBed.configureTestingModule({
20-
imports: [NgxMatDateFnsDateModule],
21-
}).compileComponents();
22-
}));
16+
beforeEach(
17+
waitForAsync(() => {
18+
TestBed.configureTestingModule({
19+
imports: [NgxMatDateFnsDateModule],
20+
}).compileComponents();
21+
})
22+
);
2323

2424
beforeEach(inject([DateAdapter], (dateAdapter: NgxDateFnsDateAdapter) => {
2525
adapter = dateAdapter;
@@ -499,12 +499,14 @@ describe('NgxDateFnsDateAdapter', () => {
499499
describe('NgxDateFnsDateAdapter with MAT_DATE_LOCALE override', () => {
500500
let adapter: NgxDateFnsDateAdapter;
501501

502-
beforeEach(async(() => {
503-
TestBed.configureTestingModule({
504-
imports: [NgxMatDateFnsDateModule],
505-
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'da' }],
506-
}).compileComponents();
507-
}));
502+
beforeEach(
503+
waitForAsync(() => {
504+
TestBed.configureTestingModule({
505+
imports: [NgxMatDateFnsDateModule],
506+
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'da' }],
507+
}).compileComponents();
508+
})
509+
);
508510

509511
beforeEach(inject([DateAdapter], (d: NgxDateFnsDateAdapter) => {
510512
adapter = d;
@@ -528,12 +530,14 @@ describe('NgxDateFnsDateAdapter with MAT_DATE_LOCALE override', () => {
528530
describe('NgxDateFnsDateAdapter with MAT_DATE_LOCALE override', () => {
529531
let adapter: NgxDateFnsDateAdapter;
530532

531-
beforeEach(async(() => {
532-
TestBed.configureTestingModule({
533-
imports: [NgxMatDateFnsDateModule],
534-
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'invalid' }],
535-
}).compileComponents();
536-
}));
533+
beforeEach(
534+
waitForAsync(() => {
535+
TestBed.configureTestingModule({
536+
imports: [NgxMatDateFnsDateModule],
537+
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'invalid' }],
538+
}).compileComponents();
539+
})
540+
);
537541

538542
beforeEach(inject([DateAdapter], (d: NgxDateFnsDateAdapter) => {
539543
adapter = d;
@@ -549,12 +553,14 @@ describe('NgxDateFnsDateAdapter with MAT_DATE_LOCALE override', () => {
549553
describe('NgxDateFnsDateAdapter with LOCALE_ID override', () => {
550554
let adapter: NgxDateFnsDateAdapter;
551555

552-
beforeEach(async(() => {
553-
TestBed.configureTestingModule({
554-
imports: [NgxMatDateFnsDateModule],
555-
providers: [{ provide: LOCALE_ID, useValue: 'da' }],
556-
}).compileComponents();
557-
}));
556+
beforeEach(
557+
waitForAsync(() => {
558+
TestBed.configureTestingModule({
559+
imports: [NgxMatDateFnsDateModule],
560+
providers: [{ provide: LOCALE_ID, useValue: 'da' }],
561+
}).compileComponents();
562+
})
563+
);
558564

559565
beforeEach(inject([DateAdapter], (d: NgxDateFnsDateAdapter) => {
560566
adapter = d;

0 commit comments

Comments
 (0)