Skip to content

Commit 4196150

Browse files
authored
fix: TT-26 Warn-of-unsaved-changes-btn-cancel (#651)
* fix: TT-26-Warn-of-unsaved-changes-btn-cancel * fix: TT-26-Warn-of-unsaved-changes-btn-cancel test
1 parent 6e5d957 commit 4196150

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ describe('CreateCustomerComponent', () => {
6363
it('should call resetCustomerForm', () => {
6464
spyOn(component.customerForm, 'reset');
6565
spyOn(component.closeCustomerComponent, 'emit');
66-
66+
spyOn(component.hasChangedEvent, 'emit');
6767
component.resetCustomerForm();
6868

6969
expect(component.customerForm.reset).toHaveBeenCalled();
7070
expect(component.closeCustomerComponent.emit).toHaveBeenCalledWith(false);
71+
expect(component.hasChangedEvent.emit).toHaveBeenCalledWith(false);
7172
});
7273

7374
it('onSubmit, dispatch CreateCustomer and LoadCustomers actions', () => {

src/app/modules/customer-management/components/customer-info/components/create-customer/create-customer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export class CreateCustomerComponent implements OnInit, OnDestroy {
9696
this.customerForm.reset();
9797
this.store.dispatch(new ResetCustomerToEdit());
9898
this.closeCustomerComponent.emit(false);
99+
this.hasChangedEvent.emit(this.hasChange = false);
99100
}
100101

101102
onInputChangeCustomer(searchValue: string): void {

0 commit comments

Comments
 (0)