mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
85262: Always enable deposit button
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
<button *ngIf="(showDepositAndDiscard | async)"
|
||||
type="button"
|
||||
class="btn btn-success"
|
||||
[disabled]="(submissionIsInvalid | async) || (processingSaveStatus | async) || (processingDepositStatus | async)"
|
||||
(click)="deposit($event)">
|
||||
<span><i class="fas fa-plus"></i> {{'submission.general.deposit' | translate}}</span>
|
||||
</button>
|
||||
|
@@ -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);
|
||||
|
@@ -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: {
|
||||
|
@@ -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))));
|
||||
|
Reference in New Issue
Block a user