Skip to content

Commit 896904a

Browse files
authored
fix: TT-26 project and project-type (#652)
1 parent fb028c0 commit 896904a

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/app/modules/customer-management/components/projects-type/components/create-project-type/create-project-type.component.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,13 @@ describe('InputProjectTypeComponent', () => {
160160

161161
it('should dispatch a ResetProjectTypeToEdit action', () => {
162162
spyOn(store, 'dispatch');
163+
spyOn(component.hasChangedEvent, 'emit');
163164

164165
component.cancelButton();
165166

166167
expect(store.dispatch).toHaveBeenCalledTimes(1);
167168
expect(store.dispatch).toHaveBeenCalledWith(new ResetProjectTypeToEdit());
169+
expect(component.hasChangedEvent.emit).toHaveBeenCalledWith(false);
168170
});
169171

170172
it('if detect changes in create project type , it should emit a true', () => {

src/app/modules/customer-management/components/projects-type/components/create-project-type/create-project-type.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export class CreateProjectTypeComponent implements OnInit, OnDestroy {
7474

7575
cancelButton() {
7676
this.store.dispatch(new ResetProjectTypeToEdit());
77+
this.hasChangedEvent.emit(this.hasChange = false);
7778
}
7879

7980
ngOnDestroy(): void {

src/app/modules/customer-management/components/projects/components/create-project/create-project.component.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,13 @@ describe('InputProjectComponent', () => {
240240

241241
it('should dispatch a ResetActivityToEdit action', () => {
242242
spyOn(store, 'dispatch');
243+
spyOn(component.hasChangedEvent, 'emit');
243244

244245
component.cancelButton();
245246

246247
expect(store.dispatch).toHaveBeenCalledTimes(1);
247248
expect(store.dispatch).toHaveBeenCalledWith(new ResetProjectToEdit());
249+
expect(component.hasChangedEvent.emit).toHaveBeenCalledWith(false);
248250
});
249251

250252
it('if detect changes in create project , it should emit a true', () => {

src/app/modules/customer-management/components/projects/components/create-project/create-project.component.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,11 @@ export class CreateProjectComponent implements OnInit, OnDestroy {
100100

101101
cancelButton() {
102102
this.store.dispatch(new actions.ResetProjectToEdit());
103+
this.hasChangedEvent.emit(this.hasChange = false);
103104
}
104105

105106
resetValuesForm() {
106-
this.projectForm.setValue({
107-
name: '',
108-
description: '',
109-
project_type_id: null,
110-
});
107+
this.projectForm.reset();
111108
}
112109

113110
onInputChangeProject(searchValue: string): void {

0 commit comments

Comments
 (0)