@@ -468,6 +468,31 @@ describe('DetailsFieldsComponent', () => {
468
468
expect ( endDateInput . value ) . not . toEqual ( startDateInput . value ) ;
469
469
expect ( startDateInput . value ) . toEqual ( expectedStartDate ) ;
470
470
} ) ;
471
+
472
+ it ( 'on get current date should return expected date' , ( ) => {
473
+ const expectedDate = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
474
+
475
+ expect ( component . getCurrentDate ( ) ) . toEqual ( expectedDate ) ;
476
+ } ) ;
477
+
478
+ it ( 'on the input with id #start_date we could get the id and max value' , ( ) => {
479
+ fixture . detectChanges ( ) ;
480
+ const expectedDate = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
481
+ const startDateInput : HTMLInputElement = fixture . debugElement .
482
+ nativeElement . querySelector ( `input[id="start_date"],input[max="${ component . getCurrentDate ( ) } "]` ) ;
483
+
484
+ expect ( startDateInput . id ) . toEqual ( 'start_date' ) ;
485
+ expect ( startDateInput . max ) . toEqual ( expectedDate ) ;
486
+ } ) ;
487
+
488
+ it ( 'on the input with id #end_date we could get the current Date ' , ( ) => {
489
+ fixture . detectChanges ( ) ;
490
+ const expectedDate = new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] ;
491
+ const endDateInput = fixture . debugElement . nativeElement . querySelector ( '[id=end_date]' ) ;
492
+
493
+ expect ( endDateInput . id ) . toEqual ( 'end_date' ) ;
494
+ expect ( endDateInput . max ) . toEqual ( expectedDate ) ;
495
+ } ) ;
471
496
/*
472
497
TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,
473
498
and now these couple of tests are failing. A solution to this error might be generate a Test Wrapper Component. More details here:
0 commit comments