diff --git a/package-lock.json b/package-lock.json index 06a2dbb45..4d3b56065 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "time-tracker", - "version": "1.31.10", + "version": "1.31.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f7ce1959a..04f7d2f15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "time-tracker", - "version": "1.31.10", + "version": "1.31.11", "scripts": { "preinstall": "npx npm-force-resolutions", "ng": "ng", diff --git a/src/app/modules/activities-management/components/activity-list/activity-list.component.html b/src/app/modules/activities-management/components/activity-list/activity-list.component.html index a4582ed10..903587928 100644 --- a/src/app/modules/activities-management/components/activity-list/activity-list.component.html +++ b/src/app/modules/activities-management/components/activity-list/activity-list.component.html @@ -4,7 +4,7 @@ Activity ID Activity - + Options diff --git a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html index 784ddf685..09b7a0b76 100644 --- a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html +++ b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html @@ -1,43 +1,45 @@ - - - - - - - - - - - - - - - - -
Customer IDNameOptions
{{ customer.id }}{{ customer.name }} - - -
+
+ + + + + + + + + + + + + + + + +
Customer IDNameOptions
{{ customer.id }}{{ customer.name }} + + +
+
action.type === CustomerManagementActionTypes.LOAD_CUSTOMERS_SUCCESS)) @@ -49,7 +50,6 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit { this.customers = action.payload; this.rerenderDataTable(); }); - this.changeCustomerSubscription = this.actionsSubject$ .pipe( filter( @@ -109,4 +109,5 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit { this.message = `Are you sure you want to delete ${item.name}?`; this.showModal = true; } + } diff --git a/src/app/modules/customer-management/pages/customer.component.html b/src/app/modules/customer-management/pages/customer.component.html index c56abeef8..a97e5d8aa 100644 --- a/src/app/modules/customer-management/pages/customer.component.html +++ b/src/app/modules/customer-management/pages/customer.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts b/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts index d41f565a8..60139632f 100644 --- a/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts +++ b/src/app/modules/shared/components/details-fields/details-fields.component.spec.ts @@ -128,14 +128,14 @@ describe('DetailsFieldsComponent', () => { expect(component).toBeTruthy(); }); - it('onClearedComponent project id and name it is set to empty', () => { + it('onClearedComponent project id and name are set to empty', () => { component.onClearedComponent(null); expect(component.project_id.value).toBe(''); expect(component.project_name.value).toBe(''); }); - it('onSelectedProject project id and name it is set using event data', () => { + it('onSelectedProject project id and name are set using event data', () => { spyOn(component.entryForm, 'patchValue'); component.onSelectedProject( {id: 'id', search_field: 'foo'} ); @@ -143,7 +143,7 @@ describe('DetailsFieldsComponent', () => { expect(component.entryForm.patchValue).toHaveBeenCalledWith( { project_id: 'id', project_name: 'foo', } ); }); - it('if form is invalid then no save is emited', () => { + it('if form is invalid then saveEntry is not emited', () => { spyOn(component.saveEntry, 'emit'); component.onSubmit(); @@ -172,6 +172,7 @@ describe('DetailsFieldsComponent', () => { it('should emit ngOnChange without data', () => { component.entryToEdit = null; component.ngOnChanges(); + expect(component.shouldRestartEntry).toBeFalse(); expect(component.entryForm.value).toEqual(initialData); }); @@ -243,6 +244,7 @@ describe('DetailsFieldsComponent', () => { }, shouldRestartEntry: false }; + expect(component.saveEntry.emit).toHaveBeenCalledWith(data); }); @@ -298,14 +300,23 @@ describe('DetailsFieldsComponent', () => { fixture.componentInstance.ngOnChanges(); expect(component.goingToWorkOnThis).toBeFalse(); + expect(component.shouldRestartEntry).toBeFalse(); }); - it('when editing entry that already finished, then the entry should not be marked as running', () => { - component.entryToEdit = { ...entryToEdit, running: false }; + it('when editing entry is running, shouldRestartEntry should be false', () => { + component.entryToEdit = { ...entryToEdit, running: true }; fixture.componentInstance.ngOnChanges(); - expect(component.goingToWorkOnThis).toBeFalse(); + expect(component.goingToWorkOnThis).toBeTrue(); + expect(component.shouldRestartEntry).toBeFalse(); + }); + + it('when editing entry change to going to work on this shouldRestartEntry should be true', () => { + component.onGoingToWorkOnThisChange({ currentTarget: { checked: true } }); + + expect(component.goingToWorkOnThis).toBeTrue(); + expect(component.shouldRestartEntry).toBeTrue(); }); it('when submitting a entry that is currently running, the end date should not be sent ', () => { @@ -328,6 +339,7 @@ describe('DetailsFieldsComponent', () => { }, shouldRestartEntry: false }; + expect(component.saveEntry.emit).toHaveBeenCalledWith(data); }); 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 566960acc..5bc62652d 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 @@ -126,6 +126,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit { ngOnChanges(): void { this.goingToWorkOnThis = this.entryToEdit ? this.entryToEdit.running : false; + this.shouldRestartEntry = false; if (this.entryToEdit) { this.selectedTechnologies = this.entryToEdit.technologies; const projectFound = this.listProjects.find((project) => project.id === this.entryToEdit.project_id);