diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.html b/src/app/modules/shared/components/details-fields/details-fields.component.html index e666a15c7..c9b6f66d0 100644 --- a/src/app/modules/shared/components/details-fields/details-fields.component.html +++ b/src/app/modules/shared/components/details-fields/details-fields.component.html @@ -112,7 +112,7 @@ -
+
-
+
{ component.onSubmit(); expect(displayError).toBeTrue(); }); + + it('should show Date out field on details field component on time entry page when another entry is running', () => { + const times = { + start_date: '2021-04-21', + end_date: '2021-04-21', + start_hour: '10:00', + end_hour: '12:00', + }; + component.goingToWorkOnThis = true; + spyOn(toastrServiceStub, 'error'); + + const fixtureToTest = TestBed.createComponent(DetailsFieldsComponent); + const componentToTest = fixtureToTest.componentInstance; + componentToTest.entryForm.setValue({ ...formValues, ...times }); + componentToTest.onSubmit(); + expect(toastrServiceStub.error).not.toHaveBeenCalled(); + }); /* TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component, and now these couple of tests are failing. A solution to this error might be generate a Test Wrapper Component. More details here: diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.ts b/src/app/modules/shared/components/details-fields/details-fields.component.ts index 203b607a5..59349e3da 100644 --- a/src/app/modules/shared/components/details-fields/details-fields.component.ts +++ b/src/app/modules/shared/components/details-fields/details-fields.component.ts @@ -292,7 +292,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { timezone_offset: new Date().getTimezoneOffset(), }; - if (this.goingToWorkOnThis) { + if (this.goingToWorkOnThis && this.canMarkEntryAsWIP) { delete entry.end_date; }