Skip to content

Commit a6a9dcb

Browse files
committed
wfprev 795
1 parent 362cc53 commit a6a9dcb

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

client/wfprev-war/src/main/angular/src/app/components/edit-project/endorsement-approval/endorsement-approval.component.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,18 @@ describe('EndorsementApprovalComponent', () => {
234234
component.fiscal = { ...mockFiscal, planFiscalStatusCode: { planFiscalStatusCode: FiscalStatuses.PREPARED } };
235235
expect(component.showDraftTooltip).toBeFalse();
236236
});
237+
238+
it('should reset isSaving when isSaving change goes from true to false', () => {
239+
component.isSaving = true;
240+
component.ngOnChanges({
241+
isSaving: {
242+
currentValue: false,
243+
previousValue: true,
244+
firstChange: false,
245+
isFirstChange: () => false,
246+
}
247+
});
248+
249+
expect(component.isSaving).toBeFalse();
250+
});
237251
});

client/wfprev-war/src/main/angular/src/app/components/edit-project/project-details/project-details.component.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,17 @@ describe('ProjectDetailsComponent', () => {
704704
expect(mockProjectService.getProjectByProjectGuid).not.toHaveBeenCalled();
705705
});
706706

707+
it('should reset isSaving after updateProject success', () => {
708+
component.onSaveProjectDescription();
709+
expect(component.isSaving).toBeFalse();
710+
});
711+
712+
it('should reset isSaving after updateProject error', () => {
713+
mockProjectService.updateProject.and.returnValue(throwError(() => new Error('fail')));
714+
component.onSaveProjectDescription();
715+
expect(component.isSaving).toBeFalse();
716+
});
717+
707718
});
708719

709720
describe('onSaveLatLong Method', () => {
@@ -721,6 +732,7 @@ describe('ProjectDetailsComponent', () => {
721732

722733
expect(component.isLatLongDirty).toBeFalse();
723734
expect(component.projectDetail.latitude).toBeGreaterThan(0);
735+
expect(component.isSaving).toBeFalse();
724736
});
725737
});
726738

@@ -803,6 +815,7 @@ describe('ProjectDetailsComponent', () => {
803815
fireCentreOrgUnitId: 123,
804816
})
805817
);
818+
expect(component.isSaving).toBeFalse();
806819
});
807820

808821
describe('refreshFiscalData Method', () => {
@@ -1151,6 +1164,7 @@ describe('ProjectDetailsComponent', () => {
11511164
'OK',
11521165
jasmine.objectContaining({ panelClass: 'snackbar-error' })
11531166
);
1167+
expect(component.isSaving).toBeFalse();
11541168
});
11551169

11561170
describe('project description input/paste', () => {

0 commit comments

Comments
 (0)