Skip to content

Commit d88352f

Browse files
committed
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
1 parent 342a712 commit d88352f

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/app/shared/form/builder/form-builder.service.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,14 @@ describe('FormBuilderService test suite', () => {
325325
typeBindRelations: [{ match: 'VISIBLE', operator: 'OR', when: [{id: 'dc.type', value: 'Book' }]}]
326326
},
327327
),
328+
329+
new DynamicConcatModel({
330+
id: 'testConcatGroup_CONCAT_GROUP',
331+
group: [
332+
new DynamicInputModel({ id: 'testConcatGroup_CONCAT_FIRST_INPUT' }),
333+
new DynamicInputModel({ id: 'testConcatGroup_CONCAT_SECOND_INPUT' }),
334+
]
335+
} as any)
328336
];
329337

330338
testFormConfiguration = {
@@ -463,6 +471,7 @@ describe('FormBuilderService test suite', () => {
463471
expect(service.findById('testTimePicker', testModel) instanceof DynamicTimePickerModel).toBe(true);
464472
expect(service.findById('testRating', testModel) instanceof DynamicRatingModel).toBe(true);
465473
expect(service.findById('testColorPicker', testModel) instanceof DynamicColorPickerModel).toBe(true);
474+
expect(service.findById('testConcatGroup', testModel) instanceof DynamicConcatModel).toBe(true);
466475
});
467476

468477
it('should find a nested dynamic form control model by id', () => {

src/app/shared/form/builder/form-builder.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ export class FormBuilderService extends DynamicFormService {
116116
}
117117

118118
if (this.isConcatGroup(controlModel)) {
119-
if (controlModel.id.match(new RegExp(findId + CONCAT_GROUP_SUFFIX + `_\\d+$`))) {
120-
result = (controlModel as DynamicConcatModel).group[0];
119+
if (controlModel.id.match(new RegExp(findId + CONCAT_GROUP_SUFFIX))) {
120+
result = (controlModel as DynamicConcatModel);
121121
break;
122122
}
123123
}

0 commit comments

Comments
 (0)