Skip to content

Commit 102a22c

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

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

src/app/modules/shared/components/details-fields/details-fields.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
aria-describedby="inputGroup-sizing-sm"
9191
[class.is-invalid]="start_date.invalid && start_date.touched"
9292
required
93-
(ngModelChange)="onInitialDatepickerUpdated($event)"
93+
(ngModelChange)="onStartDateChange($event)"
9494
/>
9595
</div>
9696

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

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -443,47 +443,31 @@ describe('DetailsFieldsComponent', () => {
443443
expect(component.projectSelected.emit).toHaveBeenCalledWith(data);
444444
});
445445

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

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

453-
expect(endDateInput.value).toEqual(expectedInitialDate);
453+
expect(endDateInput.value).toEqual(expectedStartDate);
454454
});
455455

456-
it('on Selected End Date should not change initial date', () => {
457-
const expectedInitialDate = '2020-02-05';
456+
it('on Selected End Date should not change Start Date', () => {
457+
const expectedStartDate = '2020-02-05';
458458
const expectedEndDate = '2020-02-06';
459459

460460
component.ngOnInit();
461461
fixture.detectChanges();
462462
const startDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#start_date');
463463
const endDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#end_date');
464-
startDateInput.value = expectedInitialDate;
464+
startDateInput.value = expectedStartDate;
465465
endDateInput.value = expectedEndDate;
466466
endDateInput.dispatchEvent(new Event('#end_date'));
467467

468468
expect(endDateInput.value).not.toEqual(startDateInput.value);
469469
});
470470

471-
/*
472-
fit('should be ok', () => {
473-
const expectedInitialDate = '2020-02-05';
474-
const expectedEndDate = '2020-02-06';
475-
476-
component.ngOnInit();
477-
fixture.detectChanges();
478-
const startDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#start_date');
479-
const endDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#end_date');
480-
startDateInput.value = expectedInitialDate;
481-
endDateInput.value = expectedEndDate;
482-
endDateInput.dispatchEvent(new Event('#end_date'));
483-
484-
expect(endDateInput.value).not.toEqual(expectedInitialDate);
485-
});
486-
*/
487471

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

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,8 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
124124
});
125125
}
126126

127-
onInitialDatepickerUpdated($event: string) {
128-
console.log($event);
127+
onStartDateChange($event: string) {
129128
this.end_date.setValue($event);
130-
131129
}
132130

133131

0 commit comments

Comments
 (0)