@@ -18,11 +18,6 @@ const JAN = 1, FEB = 2, MAR = 3, DEC = 12;
18
18
describe ( 'LuxonDateAdapter' , ( ) => {
19
19
let adapter : DateAdapter < DateTime > ;
20
20
21
- if ( ! isSupported ( ) ) {
22
- it ( 'should pass' , ( ) => expect ( 1 ) . toBe ( 1 ) ) ;
23
- return ;
24
- }
25
-
26
21
beforeEach ( waitForAsync ( ( ) => {
27
22
TestBed . configureTestingModule ( {
28
23
imports : [ LuxonDateModule ]
@@ -205,11 +200,11 @@ describe('LuxonDateAdapter', () => {
205
200
it ( 'should format with a different locale' , ( ) => {
206
201
let date = adapter . format ( DateTime . local ( 2017 , JAN , 2 ) , 'DD' ) ;
207
202
208
- expect ( stripDirectionalityCharacters ( date ) ) . toEqual ( 'Jan 2, 2017' ) ;
203
+ expect ( date ) . toEqual ( 'Jan 2, 2017' ) ;
209
204
adapter . setLocale ( 'da-DK' ) ;
210
205
211
206
date = adapter . format ( DateTime . local ( 2017 , JAN , 2 ) , 'DD' ) ;
212
- expect ( stripDirectionalityCharacters ( date ) ) . toEqual ( '2. jan. 2017' ) ;
207
+ expect ( date ) . toEqual ( '2. jan. 2017' ) ;
213
208
} ) ;
214
209
215
210
it ( 'should throw when attempting to format invalid date' , ( ) => {
@@ -377,11 +372,6 @@ describe('LuxonDateAdapter', () => {
377
372
describe ( 'LuxonDateAdapter with MAT_DATE_LOCALE override' , ( ) => {
378
373
let adapter : DateAdapter < DateTime > ;
379
374
380
- if ( ! isSupported ( ) ) {
381
- it ( 'should pass' , ( ) => expect ( 1 ) . toBe ( 1 ) ) ;
382
- return ;
383
- }
384
-
385
375
beforeEach ( waitForAsync ( ( ) => {
386
376
TestBed . configureTestingModule ( {
387
377
imports : [ LuxonDateModule ] ,
@@ -393,18 +383,13 @@ describe('LuxonDateAdapter with MAT_DATE_LOCALE override', () => {
393
383
394
384
it ( 'should take the default locale id from the MAT_DATE_LOCALE injection token' , ( ) => {
395
385
const date = adapter . format ( DateTime . local ( 2017 , JAN , 2 ) , 'DD' ) ;
396
- expect ( stripDirectionalityCharacters ( date ) ) . toEqual ( '2. jan. 2017' ) ;
386
+ expect ( date ) . toEqual ( '2. jan. 2017' ) ;
397
387
} ) ;
398
388
} ) ;
399
389
400
390
describe ( 'LuxonDateAdapter with LOCALE_ID override' , ( ) => {
401
391
let adapter : DateAdapter < DateTime > ;
402
392
403
- if ( ! isSupported ( ) ) {
404
- it ( 'should pass' , ( ) => expect ( 1 ) . toBe ( 1 ) ) ;
405
- return ;
406
- }
407
-
408
393
beforeEach ( waitForAsync ( ( ) => {
409
394
TestBed . configureTestingModule ( {
410
395
imports : [ LuxonDateModule ] ,
@@ -416,20 +401,13 @@ describe('LuxonDateAdapter with LOCALE_ID override', () => {
416
401
417
402
it ( 'should take the default locale id from the LOCALE_ID injection token' , ( ) => {
418
403
const date = adapter . format ( DateTime . local ( 2017 , JAN , 2 ) , 'DD' ) ;
419
-
420
- // Some browsers add extra invisible characters that we should strip before asserting.
421
- expect ( stripDirectionalityCharacters ( date ) ) . toEqual ( '2 janv. 2017' ) ;
404
+ expect ( date ) . toEqual ( '2 janv. 2017' ) ;
422
405
} ) ;
423
406
} ) ;
424
407
425
408
describe ( 'LuxonDateAdapter with MAT_LUXON_DATE_ADAPTER_OPTIONS override' , ( ) => {
426
409
let adapter : DateAdapter < DateTime > ;
427
410
428
- if ( ! isSupported ( ) ) {
429
- it ( 'should pass' , ( ) => expect ( 1 ) . toBe ( 1 ) ) ;
430
- return ;
431
- }
432
-
433
411
beforeEach ( waitForAsync ( ( ) => {
434
412
TestBed . configureTestingModule ( {
435
413
imports : [ LuxonDateModule ] ,
@@ -467,16 +445,6 @@ describe('LuxonDateAdapter with MAT_LUXON_DATE_ADAPTER_OPTIONS override', () =>
467
445
468
446
} ) ;
469
447
470
-
471
- function isSupported ( ) : boolean {
472
- // As of version 2.0.0 Luxon doesn't support any version of IE so we have to skip the tests there.
473
- return typeof navigator !== 'undefined' && ! ( / ( m s i e | t r i d e n t | e d g e ) / i. test ( navigator . userAgent ) ) ;
474
- }
475
-
476
- function stripDirectionalityCharacters ( str : string ) {
477
- return str . replace ( / [ \u200e \u200f ] / g, '' ) ;
478
- }
479
-
480
448
function assertValidDate ( adapter : DateAdapter < DateTime > , d : DateTime | null , valid : boolean ) {
481
449
expect ( adapter . isDateInstance ( d ) ) . not
482
450
. withContext ( `Expected ${ d } to be a date instance` ) . toBeNull ( ) ;
0 commit comments