mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Merge branch 'fix-systemwidealert-form-validation_contribute-7.6' into fix-systemwidealert-form-validation_contribute-main
This commit is contained in:
@@ -311,6 +311,14 @@ describe('SystemWideAlertFormComponent', () => {
|
|||||||
expect(comp.back).not.toHaveBeenCalled();
|
expect(comp.back).not.toHaveBeenCalled();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
it('should not create the new alert when the enable button is clicked on an invalid the form', () => {
|
||||||
|
spyOn(comp as any, 'handleResponse');
|
||||||
|
|
||||||
|
comp.formMessage.patchValue('');
|
||||||
|
comp.save();
|
||||||
|
|
||||||
|
expect((comp as any).handleResponse).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('back', () => {
|
describe('back', () => {
|
||||||
it('should navigate back to the home page', () => {
|
it('should navigate back to the home page', () => {
|
||||||
|
@@ -256,6 +256,7 @@ export class SystemWideAlertFormComponent implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
alert.countdownTo = null;
|
alert.countdownTo = null;
|
||||||
}
|
}
|
||||||
|
if (this.alertForm.valid) {
|
||||||
if (hasValue(this.currentAlert)) {
|
if (hasValue(this.currentAlert)) {
|
||||||
const updatedAlert = Object.assign(new SystemWideAlert(), this.currentAlert, alert);
|
const updatedAlert = Object.assign(new SystemWideAlert(), this.currentAlert, alert);
|
||||||
this.handleResponse(this.systemWideAlertDataService.put(updatedAlert), 'system-wide-alert.form.update', navigateToHomePage);
|
this.handleResponse(this.systemWideAlertDataService.put(updatedAlert), 'system-wide-alert.form.update', navigateToHomePage);
|
||||||
@@ -263,6 +264,7 @@ export class SystemWideAlertFormComponent implements OnInit {
|
|||||||
this.handleResponse(this.systemWideAlertDataService.create(alert), 'system-wide-alert.form.create', navigateToHomePage);
|
this.handleResponse(this.systemWideAlertDataService.create(alert), 'system-wide-alert.form.create', navigateToHomePage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private handleResponse(response$: Observable<RemoteData<SystemWideAlert>>, messagePrefix, navigateToHomePage: boolean) {
|
private handleResponse(response$: Observable<RemoteData<SystemWideAlert>>, messagePrefix, navigateToHomePage: boolean) {
|
||||||
response$.pipe(
|
response$.pipe(
|
||||||
|
Reference in New Issue
Block a user