Fixed an issue with showing form error in FormSectionComponent and added comments

This commit is contained in:
Giuseppe Digilio
2019-03-18 11:11:01 +01:00
parent bbd6225cd4
commit 2473ef3077
2 changed files with 166 additions and 37 deletions

View File

@@ -318,6 +318,23 @@ describe('FormSectionComponent test suite', () => {
});
it('should update form error properly', () => {
spyOn(comp, 'initForm');
spyOn(comp, 'checksForErrors');
const sectionData: any = {
'dc.title': [new FormFieldMetadataValueObject('test')]
};
comp.sectionData.data = {};
comp.sectionData.errors = [];
compAsAny.formData = sectionData;
comp.updateForm(sectionData, parsedSectionErrors);
expect(comp.initForm).not.toHaveBeenCalled();
expect(comp.checksForErrors).toHaveBeenCalled();
expect(comp.sectionData.data).toEqual(sectionData);
});
it('should update form error properly', () => {
spyOn(comp, 'initForm');
spyOn(comp, 'checksForErrors');