diff --git a/package-lock.json b/package-lock.json index cbce4af14..c92c5caf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "time-tracker", - "version": "1.45.0", + "version": "1.45.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7e227b4a0..bb4c011e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "time-tracker", - "version": "1.45.0", + "version": "1.45.1", "scripts": { "preinstall": "npx npm-force-resolutions", "ng": "ng", 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; } diff --git a/src/app/modules/time-entries/pages/time-entries.component.spec.ts b/src/app/modules/time-entries/pages/time-entries.component.spec.ts index 298db6cb5..c3c2b7a0a 100644 --- a/src/app/modules/time-entries/pages/time-entries.component.spec.ts +++ b/src/app/modules/time-entries/pages/time-entries.component.spec.ts @@ -381,7 +381,7 @@ describe('TimeEntriesComponent', () => { uri: 'http://testing.is.fun', activity_id: 'sss', project_id: 'id', - start_date: new Date(new Date().setHours(0, 0, 0, 0)), + start_date: new Date(), end_date: new Date(new Date().setHours(0, 0, 0, 0)) }; state.timeEntriesDataSource.data = [lastEntry]; diff --git a/src/app/modules/time-entries/pages/time-entries.component.ts b/src/app/modules/time-entries/pages/time-entries.component.ts index b6799b99c..fd3c76981 100644 --- a/src/app/modules/time-entries/pages/time-entries.component.ts +++ b/src/app/modules/time-entries/pages/time-entries.component.ts @@ -125,7 +125,7 @@ export class TimeEntriesComponent implements OnInit, OnDestroy { uri: dataToUse.uri ? dataToUse.uri : '', activity_id: dataToUse.activity_id, project_id: dataToUse.project_id, - start_date: startDate, + start_date: new Date(), end_date: startDate }; this.entry = entry;