@@ -443,6 +443,38 @@ describe('DetailsFieldsComponent', () => {
443443 expect ( component . projectSelected . emit ) . toHaveBeenCalledWith ( data ) ;
444444 } ) ;
445445
446+ it ( 'on Selected Initial Date should change end date' , ( ) => {
447+ const expectedDate = '2020-02-05' ;
448+
449+ component . onInitialDatepickerUpdated ( expectedDate ) ;
450+ fixture . detectChanges ( ) ;
451+ const endDateInput : HTMLInputElement = fixture . debugElement . nativeElement . querySelector ( '#end_date' ) ;
452+
453+ expect ( endDateInput . value ) . toEqual ( expectedDate ) ;
454+
455+ } ) ;
456+
457+ it ( 'on Selected End Date should not change initial date' , ( ) => {
458+ const expectedInitialDate = '2020-02-05' ;
459+ const expectedEndDate = '2020-02-06' ;
460+ component . onInitialDatepickerUpdated ( expectedInitialDate ) ;
461+ fixture . detectChanges ( ) ;
462+ const endDateInput : HTMLInputElement = fixture . debugElement . nativeElement . querySelector ( '#end_date' ) ;
463+
464+ expect ( endDateInput . value ) . toEqual ( expectedInitialDate ) ;
465+
466+ } ) ;
467+
468+ fit ( 'should be ok' , ( ) => {
469+ component . ngOnInit ( ) ;
470+ fixture . detectChanges ( ) ;
471+ const endDateInput : HTMLInputElement = fixture . debugElement . nativeElement . querySelector ( '#end_date' ) ;
472+ endDateInput . value = '2021-02-21' ;
473+ endDateInput . dispatchEvent ( new Event ( '#end_date' ) ) ;
474+
475+ expect ( endDateInput . value ) . toBe ( '2021-02-21' ) ;
476+ } ) ;
477+
446478 /*
447479 TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,
448480 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