mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
add submissionId to fieldparser, and refactor to create fieldparsers using DI
This commit is contained in:
@@ -6,6 +6,7 @@ import { ParserOptions } from './parser-options';
|
||||
describe('DropdownFieldParser test suite', () => {
|
||||
let field: FormFieldModel;
|
||||
|
||||
const submissionId = '1234';
|
||||
const initFormValues = {};
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
@@ -35,13 +36,13 @@ describe('DropdownFieldParser test suite', () => {
|
||||
});
|
||||
|
||||
it('should init parser properly', () => {
|
||||
const parser = new DropdownFieldParser(field, initFormValues, parserOptions);
|
||||
const parser = new DropdownFieldParser(submissionId, field, initFormValues, parserOptions);
|
||||
|
||||
expect(parser instanceof DropdownFieldParser).toBe(true);
|
||||
});
|
||||
|
||||
it('should return a DynamicScrollableDropdownModel object when repeatable option is false', () => {
|
||||
const parser = new DropdownFieldParser(field, initFormValues, parserOptions);
|
||||
const parser = new DropdownFieldParser(submissionId, field, initFormValues, parserOptions);
|
||||
|
||||
const fieldModel = parser.parse();
|
||||
|
||||
@@ -50,7 +51,7 @@ describe('DropdownFieldParser test suite', () => {
|
||||
|
||||
it('should throw when authority is not passed', () => {
|
||||
field.selectableMetadata[0].authority = null;
|
||||
const parser = new DropdownFieldParser(field, initFormValues, parserOptions);
|
||||
const parser = new DropdownFieldParser(submissionId, field, initFormValues, parserOptions);
|
||||
|
||||
expect(() => parser.parse())
|
||||
.toThrow();
|
||||
|
Reference in New Issue
Block a user