From 5e17a4e958db858bc7eee8c4806ee51ce46ff00b Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Tue, 30 Nov 2021 13:27:16 +0100 Subject: [PATCH] 85262: Always enable deposit button --- .../submission-form-footer.component.html | 1 - .../submission-form-footer.component.spec.ts | 9 ---- .../submission-objects.effects.spec.ts | 53 ------------------- .../objects/submission-objects.effects.ts | 4 +- 4 files changed, 1 insertion(+), 66 deletions(-) diff --git a/src/app/submission/form/footer/submission-form-footer.component.html b/src/app/submission/form/footer/submission-form-footer.component.html index 4964eb56a2..203f7e2afa 100644 --- a/src/app/submission/form/footer/submission-form-footer.component.html +++ b/src/app/submission/form/footer/submission-form-footer.component.html @@ -41,7 +41,6 @@ diff --git a/src/app/submission/form/footer/submission-form-footer.component.spec.ts b/src/app/submission/form/footer/submission-form-footer.component.spec.ts index dd47dad444..dbeb4ee00d 100644 --- a/src/app/submission/form/footer/submission-form-footer.component.spec.ts +++ b/src/app/submission/form/footer/submission-form-footer.component.spec.ts @@ -201,15 +201,6 @@ describe('SubmissionFormFooterComponent Component', () => { }); }); - it('should have deposit button disabled when submission is not valid', () => { - comp.showDepositAndDiscard = observableOf(true); - compAsAny.submissionIsInvalid = observableOf(true); - fixture.detectChanges(); - const depositBtn: any = fixture.debugElement.query(By.css('.btn-success')); - - expect(depositBtn.nativeElement.disabled).toBeTruthy(); - }); - it('should not have deposit button disabled when submission is valid', () => { comp.showDepositAndDiscard = observableOf(true); compAsAny.submissionIsInvalid = observableOf(false); diff --git a/src/app/submission/objects/submission-objects.effects.spec.ts b/src/app/submission/objects/submission-objects.effects.spec.ts index 122ebd90ac..8e763fd94b 100644 --- a/src/app/submission/objects/submission-objects.effects.spec.ts +++ b/src/app/submission/objects/submission-objects.effects.spec.ts @@ -879,59 +879,6 @@ describe('SubmissionObjectEffects test suite', () => { expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected); }); - it('should not allow to deposit when there are errors', () => { - store.nextState({ - submission: { - objects: submissionState - } - } as any); - - actions = hot('--a-', { - a: { - type: SubmissionObjectActionTypes.SAVE_AND_DEPOSIT_SUBMISSION, - payload: { - submissionId: submissionId - } - } - }); - - const response = [Object.assign({}, mockSubmissionRestResponse[0], { - sections: mockSectionsData, - errors: mockSectionsErrors - })]; - - submissionJsonPatchOperationsServiceStub.jsonPatchByResourceType.and.returnValue(observableOf(response)); - - const errorsList = parseSectionErrors(mockSectionsErrors); - const expected = cold('--b-', { - b: [ - new UpdateSectionDataAction( - submissionId, - 'traditionalpageone', - mockSectionsData.traditionalpageone as any, - errorsList.traditionalpageone || [], - errorsList.traditionalpageone || [] - ), - new UpdateSectionDataAction( - submissionId, - 'license', - mockSectionsData.license as any, - errorsList.license || [], - errorsList.license || [] - ), - new UpdateSectionDataAction( - submissionId, - 'upload', - mockSectionsData.upload as any, - errorsList.upload || [], - errorsList.upload || [] - ) - ] - }); - - expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected); - }); - it('should catch errors and return a SAVE_SUBMISSION_FORM_ERROR', () => { actions = hot('--a-', { a: { diff --git a/src/app/submission/objects/submission-objects.effects.ts b/src/app/submission/objects/submission-objects.effects.ts index b4ba1c2480..535e662922 100644 --- a/src/app/submission/objects/submission-objects.effects.ts +++ b/src/app/submission/objects/submission-objects.effects.ts @@ -206,9 +206,7 @@ export class SubmissionObjectEffects { if (this.canDeposit(response)) { return new DepositSubmissionAction(action.payload.submissionId); } else { - this.notificationsService.warning(null, this.translate.get('submission.sections.general.sections_not_valid')); - return this.parseSaveResponse((currentState.submission as SubmissionState).objects[action.payload.submissionId], - response, action.payload.submissionId, currentState.forms); + return new SaveSubmissionFormSuccessAction(action.payload.submissionId, response); } }), catchError(() => observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId))));