Skip to content

Commit

Permalink
test: Fix date constants for the Angular 11
Browse files Browse the repository at this point in the history
  • Loading branch information
sapozhnikovay committed Dec 20, 2020
1 parent 2c9224f commit 0b011aa
Showing 1 changed file with 38 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { LOCALE_ID } from '@angular/core';
import { async, inject, TestBed } from '@angular/core/testing';
import {
DateAdapter,
DEC,
FEB,
JAN,
MAR,
MAT_DATE_LOCALE,
} from '@angular/material/core';
import { inject, TestBed, waitForAsync } from '@angular/core/testing';
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
import { NgxDateFnsDateAdapter } from './ngx-mat-datefns-date-adapter';
import { NgxMatDateFnsDateModule } from './ngx-mat-datefns-date-adapter.module';

const JAN = 0,
FEB = 1,
MAR = 2,
DEC = 11;

describe('NgxDateFnsDateAdapter', () => {
let adapter: NgxDateFnsDateAdapter;
let assertValidDate: (d: Date | null, valid: boolean) => void;

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [NgxMatDateFnsDateModule],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [NgxMatDateFnsDateModule],
}).compileComponents();
})
);

beforeEach(inject([DateAdapter], (dateAdapter: NgxDateFnsDateAdapter) => {
adapter = dateAdapter;
Expand Down Expand Up @@ -499,12 +499,14 @@ describe('NgxDateFnsDateAdapter', () => {
describe('NgxDateFnsDateAdapter with MAT_DATE_LOCALE override', () => {
let adapter: NgxDateFnsDateAdapter;

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [NgxMatDateFnsDateModule],
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'da' }],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [NgxMatDateFnsDateModule],
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'da' }],
}).compileComponents();
})
);

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

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [NgxMatDateFnsDateModule],
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'invalid' }],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [NgxMatDateFnsDateModule],
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'invalid' }],
}).compileComponents();
})
);

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

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [NgxMatDateFnsDateModule],
providers: [{ provide: LOCALE_ID, useValue: 'da' }],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [NgxMatDateFnsDateModule],
providers: [{ provide: LOCALE_ID, useValue: 'da' }],
}).compileComponents();
})
);

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

0 comments on commit 0b011aa

Please sign in to comment.