From ea304533cae1174c6a7da4dc116a39fbc6026dd9 Mon Sep 17 00:00:00 2001 From: Sandro Castillo Date: Wed, 24 Mar 2021 11:32:38 -0500 Subject: [PATCH 1/2] fix: TT-26-Warn-of-unsaved-changes-btn-cancel --- .../customer-info/components/create-customer/create-customer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.ts b/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.ts index 6e0c4cf05..cc0f5f71a 100644 --- a/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.ts +++ b/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.ts @@ -96,6 +96,7 @@ export class CreateCustomerComponent implements OnInit, OnDestroy { this.customerForm.reset(); this.store.dispatch(new ResetCustomerToEdit()); this.closeCustomerComponent.emit(false); + this.hasChangedEvent.emit(this.hasChange = false); } onInputChangeCustomer(searchValue: string): void { From 6cc45dc043c997f2698c6bbad92e2f8c94a0a0d3 Mon Sep 17 00:00:00 2001 From: Sandro Castillo Date: Wed, 24 Mar 2021 11:39:06 -0500 Subject: [PATCH 2/2] fix: TT-26-Warn-of-unsaved-changes-btn-cancel test --- .../components/create-customer/create-customer.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.spec.ts b/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.spec.ts index 3f712e92e..be1c8425a 100644 --- a/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.spec.ts +++ b/src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.spec.ts @@ -63,11 +63,12 @@ describe('CreateCustomerComponent', () => { it('should call resetCustomerForm', () => { spyOn(component.customerForm, 'reset'); spyOn(component.closeCustomerComponent, 'emit'); - + spyOn(component.hasChangedEvent, 'emit'); component.resetCustomerForm(); expect(component.customerForm.reset).toHaveBeenCalled(); expect(component.closeCustomerComponent.emit).toHaveBeenCalledWith(false); + expect(component.hasChangedEvent.emit).toHaveBeenCalledWith(false); }); it('onSubmit, dispatch CreateCustomer and LoadCustomers actions', () => {