[835] Auto-save in new Item Submission form breaks the form

Minor fixes and method computeSectionConfiguredMetadata tested
This commit is contained in:
Alessandro Martelli
2020-12-21 19:21:49 +01:00
parent 042d2e71f0
commit 8e77fac638
6 changed files with 29 additions and 6 deletions

View File

@@ -380,4 +380,25 @@ describe('SectionsService test suite', () => {
expect(store.dispatch).toHaveBeenCalledWith(new UpdateSectionDataAction(submissionId, sectionId, data, []));
});
});
describe('computeSectionConfiguredMetadata', () => {
it('should return the configured metadata of the section from the form configuration', () => {
const formConfig = {
rows: [{
fields: [{
selectableMetadata: [{
metadata: 'dc.contributor.author'
}]
}]
}]
}
const expectedConfiguredMetadata = [ 'dc.contributor.author' ];
const configuredMetadata = service.computeSectionConfiguredMetadata(formConfig as any);
expect(configuredMetadata).toEqual(expectedConfiguredMetadata);
});
});
});