59334: added validation

This commit is contained in:
lotte
2019-02-12 12:48:32 +01:00
parent 45c699e4d8
commit 714811dc07
17 changed files with 226 additions and 52 deletions

View File

@@ -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>

View File

@@ -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();
});
});
});

View File

@@ -112,4 +112,8 @@ export class ComColFormComponent<T extends DSpaceObject> implements OnInit {
}
);
}
onCancel() {
this.location.back();
}
}