Skip to content

Commit 85016d9

Browse files
wobravoscastillo-jp
authored andcommitted
fix: TT-149 When edit Date In update the Date Out
1 parent 3d41cbe commit 85016d9

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/app/modules/shared/components/details-fields/details-fields.component.spec.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,36 +444,46 @@ describe('DetailsFieldsComponent', () => {
444444
});
445445

446446
it('on Selected Initial Date should change end date', () => {
447-
const expectedDate = '2020-02-05';
447+
const expectedInitialDate = '2020-02-05';
448448

449-
component.onInitialDatepickerUpdated(expectedDate);
449+
component.onInitialDatepickerUpdated(expectedInitialDate);
450450
fixture.detectChanges();
451451
const endDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#end_date');
452452

453-
expect(endDateInput.value).toEqual(expectedDate);
454-
453+
expect(endDateInput.value).toEqual(expectedInitialDate);
455454
});
456455

457456
it('on Selected End Date should not change initial date', () => {
458457
const expectedInitialDate = '2020-02-05';
459458
const expectedEndDate = '2020-02-06';
460-
component.onInitialDatepickerUpdated(expectedInitialDate);
459+
460+
component.ngOnInit();
461461
fixture.detectChanges();
462+
const startDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#start_date');
462463
const endDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#end_date');
464+
startDateInput.value = expectedInitialDate;
465+
endDateInput.value = expectedEndDate;
466+
endDateInput.dispatchEvent(new Event('#end_date'));
463467

464-
expect(endDateInput.value).toEqual(expectedInitialDate);
465-
468+
expect(endDateInput.value).not.toEqual(startDateInput.value);
466469
});
467470

471+
/*
468472
fit('should be ok', () => {
473+
const expectedInitialDate = '2020-02-05';
474+
const expectedEndDate = '2020-02-06';
475+
469476
component.ngOnInit();
470477
fixture.detectChanges();
478+
const startDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#start_date');
471479
const endDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#end_date');
472-
endDateInput.value = '2021-02-21';
480+
startDateInput.value = expectedInitialDate;
481+
endDateInput.value = expectedEndDate;
473482
endDateInput.dispatchEvent(new Event('#end_date'));
474483
475-
expect(endDateInput.value).toBe('2021-02-21');
484+
expect(endDateInput.value).not.toEqual(expectedInitialDate);
476485
});
486+
*/
477487

478488
/*
479489
TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,

0 commit comments

Comments
 (0)