Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: TT-149 When edit Date In update the Date Out
  • Loading branch information
wobravo authored and scastillo-jp committed Feb 24, 2021
commit 102a22c91afd511a539dd3242e1be44bffeebbb5
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
aria-describedby="inputGroup-sizing-sm"
[class.is-invalid]="start_date.invalid && start_date.touched"
required
(ngModelChange)="onInitialDatepickerUpdated($event)"
(ngModelChange)="onStartDateChange($event)"
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,47 +443,31 @@ describe('DetailsFieldsComponent', () => {
expect(component.projectSelected.emit).toHaveBeenCalledWith(data);
});

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

component.onInitialDatepickerUpdated(expectedInitialDate);
component.onStartDateChange(expectedStartDate);
fixture.detectChanges();
const endDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#end_date');

expect(endDateInput.value).toEqual(expectedInitialDate);
expect(endDateInput.value).toEqual(expectedStartDate);
});

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

component.ngOnInit();
fixture.detectChanges();
const startDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#start_date');
const endDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#end_date');
startDateInput.value = expectedInitialDate;
startDateInput.value = expectedStartDate;
endDateInput.value = expectedEndDate;
endDateInput.dispatchEvent(new Event('#end_date'));

expect(endDateInput.value).not.toEqual(startDateInput.value);
});

/*
fit('should be ok', () => {
const expectedInitialDate = '2020-02-05';
const expectedEndDate = '2020-02-06';

component.ngOnInit();
fixture.detectChanges();
const startDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#start_date');
const endDateInput: HTMLInputElement = fixture.debugElement.nativeElement.querySelector('#end_date');
startDateInput.value = expectedInitialDate;
endDateInput.value = expectedEndDate;
endDateInput.dispatchEvent(new Event('#end_date'));

expect(endDateInput.value).not.toEqual(expectedInitialDate);
});
*/

/*
TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,8 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
});
}

onInitialDatepickerUpdated($event: string) {
console.log($event);
onStartDateChange($event: string) {
this.end_date.setValue($event);

}


Expand Down