mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
94031: Fix findById for concat fields
As far as I can tell the suffix is never used with a numeric part, causing this branch to always miss concat group fields
This commit is contained in:

committed by
Yury Bondarenko

parent
342a712513
commit
d88352f513
@@ -325,6 +325,14 @@ describe('FormBuilderService test suite', () => {
|
|||||||
typeBindRelations: [{ match: 'VISIBLE', operator: 'OR', when: [{id: 'dc.type', value: 'Book' }]}]
|
typeBindRelations: [{ match: 'VISIBLE', operator: 'OR', when: [{id: 'dc.type', value: 'Book' }]}]
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
|
new DynamicConcatModel({
|
||||||
|
id: 'testConcatGroup_CONCAT_GROUP',
|
||||||
|
group: [
|
||||||
|
new DynamicInputModel({ id: 'testConcatGroup_CONCAT_FIRST_INPUT' }),
|
||||||
|
new DynamicInputModel({ id: 'testConcatGroup_CONCAT_SECOND_INPUT' }),
|
||||||
|
]
|
||||||
|
} as any)
|
||||||
];
|
];
|
||||||
|
|
||||||
testFormConfiguration = {
|
testFormConfiguration = {
|
||||||
@@ -463,6 +471,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
expect(service.findById('testTimePicker', testModel) instanceof DynamicTimePickerModel).toBe(true);
|
expect(service.findById('testTimePicker', testModel) instanceof DynamicTimePickerModel).toBe(true);
|
||||||
expect(service.findById('testRating', testModel) instanceof DynamicRatingModel).toBe(true);
|
expect(service.findById('testRating', testModel) instanceof DynamicRatingModel).toBe(true);
|
||||||
expect(service.findById('testColorPicker', testModel) instanceof DynamicColorPickerModel).toBe(true);
|
expect(service.findById('testColorPicker', testModel) instanceof DynamicColorPickerModel).toBe(true);
|
||||||
|
expect(service.findById('testConcatGroup', testModel) instanceof DynamicConcatModel).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find a nested dynamic form control model by id', () => {
|
it('should find a nested dynamic form control model by id', () => {
|
||||||
|
@@ -116,8 +116,8 @@ export class FormBuilderService extends DynamicFormService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.isConcatGroup(controlModel)) {
|
if (this.isConcatGroup(controlModel)) {
|
||||||
if (controlModel.id.match(new RegExp(findId + CONCAT_GROUP_SUFFIX + `_\\d+$`))) {
|
if (controlModel.id.match(new RegExp(findId + CONCAT_GROUP_SUFFIX))) {
|
||||||
result = (controlModel as DynamicConcatModel).group[0];
|
result = (controlModel as DynamicConcatModel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user