[TLC-254] tidy up imports, regexes, mock data

This commit is contained in:
Kim Shepherd
2022-04-23 16:54:52 +12:00
parent e182378572
commit be6ea812bb
4 changed files with 4 additions and 24 deletions

View File

@@ -14,7 +14,7 @@ import {
DynamicEditorModel, DynamicEditorModel,
DynamicFileUploadModel, DynamicFileUploadModel,
DynamicFormArrayModel, DynamicFormArrayModel,
DynamicFormControlModel, DynamicFormControlRelation, DynamicFormControlModel,
DynamicFormGroupModel, DynamicFormGroupModel,
DynamicFormsCoreModule, DynamicFormsCoreModule,
DynamicFormService, DynamicFormService,

View File

@@ -73,7 +73,7 @@ export class FormBuilderService extends DynamicFormService {
this.formModels = new Map(); this.formModels = new Map();
this.formGroups = new Map(); this.formGroups = new Map();
// Replace . with _ in configured type field here, to make configuration more simple and user-friendly // Replace . with _ in configured type field here, to make configuration more simple and user-friendly
this.typeField = environment.submission.typeBind.field.replace('\.', '_'); this.typeField = environment.submission.typeBind.field.replace(/\./g, '_');
} }
createDynamicFormControlEvent(control: FormControl, group: FormGroup, model: DynamicFormControlModel, type: string): DynamicFormControlEvent { createDynamicFormControlEvent(control: FormControl, group: FormGroup, model: DynamicFormControlModel, type: string): DynamicFormControlEvent {

View File

@@ -40,7 +40,7 @@ export abstract class FieldParser {
@Inject(PARSER_OPTIONS) protected parserOptions: ParserOptions @Inject(PARSER_OPTIONS) protected parserOptions: ParserOptions
) { ) {
// Replace . with _ in configured type field here, to make configuration more simple and user-friendly // Replace . with _ in configured type field here, to make configuration more simple and user-friendly
this.typeField = environment.submission.typeBind.field.replace('\.', '_'); this.typeField = environment.submission.typeBind.field.replace(/\./g, '_');
} }
public abstract modelFactory(fieldValue?: FormFieldMetadataValueObject, label?: boolean): any; public abstract modelFactory(fieldValue?: FormFieldMetadataValueObject, label?: boolean): any;

View File

@@ -4,26 +4,6 @@ import {DsDynamicInputModel} from '../form/builder/ds-dynamic-form-ui/models/ds-
export function getMockFormBuilderService(): FormBuilderService { export function getMockFormBuilderService(): FormBuilderService {
const inputWithTypeBindConfig = {
name: 'testWithTypeBind',
id: 'testWithTypeBind',
readOnly: false,
disabled: false,
repeatable: false,
value: {
value: 'testWithTypeBind',
display: 'testWithTypeBind'
},
submissionId: '1234',
metadataFields: [],
hasSelectableMetadata: false,
typeBindRelations: [
{match: 'VISIBLE', operator: 'OR', when: [{'id': 'dc.type', 'value': 'boundType'}]}
]
};
const thing = new DsDynamicInputModel(inputWithTypeBindConfig);
return jasmine.createSpyObj('FormBuilderService', { return jasmine.createSpyObj('FormBuilderService', {
modelFromConfiguration: [], modelFromConfiguration: [],
createFormGroup: new FormGroup({}), createFormGroup: new FormGroup({}),
@@ -55,7 +35,7 @@ export function getMockFormBuilderService(): FormBuilderService {
metadataFields: ['dc.type'], metadataFields: ['dc.type'],
hasSelectableMetadata: false, hasSelectableMetadata: false,
typeBindRelations: [ typeBindRelations: [
{match: 'VISIBLE', operator: 'OR', when: [{'id': 'dc.type', 'value': 'boundType'}]} {match: 'VISIBLE', operator: 'OR', when: [{id: 'dc.type', value: 'boundType'}]}
] ]
} }
) )