mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 15:03:07 +00:00
59334: added validation
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
<ds-form *ngIf="formModel"
|
||||
[formId]="'comcol-form-id'"
|
||||
[formModel]="formModel" (submitForm)="onSubmit()"></ds-form>
|
||||
[formModel]="formModel" (submitForm)="onSubmit()" (cancel)="onCancel()"></ds-form>
|
||||
|
@@ -50,10 +50,7 @@ describe('ComColFormComponent', () => {
|
||||
];
|
||||
|
||||
/* tslint:disable:no-empty */
|
||||
const locationStub = {
|
||||
back: () => {
|
||||
}
|
||||
};
|
||||
const locationStub = jasmine.createSpyObj('location', ['back']);
|
||||
/* tslint:enable:no-empty */
|
||||
|
||||
beforeEach(async(() => {
|
||||
@@ -112,4 +109,11 @@ describe('ComColFormComponent', () => {
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
describe('onCancel', () => {
|
||||
it('should call the back method on the Location service', () => {
|
||||
comp.onCancel();
|
||||
expect(locationStub.back).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -112,4 +112,8 @@ export class ComColFormComponent<T extends DSpaceObject> implements OnInit {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onCancel() {
|
||||
this.location.back();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user