From 5a3082b85e39ae5f9711395bd77586fc2c594673 Mon Sep 17 00:00:00 2001 From: Nina Kylstad Date: Mon, 4 Nov 2024 10:44:55 +0100 Subject: [PATCH] fix(ui-editor): ActionButton and CustomButton as valid children for ButtonGroup (#13935) --- .../packages/ux-editor/src/data/formItemConfig.ts | 2 ++ .../ux-editor/src/utils/formLayoutUtils.test.tsx | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/packages/ux-editor/src/data/formItemConfig.ts b/frontend/packages/ux-editor/src/data/formItemConfig.ts index d77163aafe9..e2ff39a6241 100644 --- a/frontend/packages/ux-editor/src/data/formItemConfig.ts +++ b/frontend/packages/ux-editor/src/data/formItemConfig.ts @@ -123,7 +123,9 @@ export const formItemConfigs: FormItemConfigs = { propertyPath: 'definitions/buttonGroupComponent', icon: FingerButtonIcon, validChildTypes: [ + ComponentType.ActionButton, ComponentType.Button, + ComponentType.CustomButton, ComponentType.NavigationButtons, ComponentType.PrintButton, ComponentType.InstantiationButton, diff --git a/frontend/packages/ux-editor/src/utils/formLayoutUtils.test.tsx b/frontend/packages/ux-editor/src/utils/formLayoutUtils.test.tsx index ca584c8c255..676fbac8a86 100644 --- a/frontend/packages/ux-editor/src/utils/formLayoutUtils.test.tsx +++ b/frontend/packages/ux-editor/src/utils/formLayoutUtils.test.tsx @@ -512,10 +512,15 @@ describe('formLayoutUtils', () => { }); describe('isComponentTypeValidChild', () => { - it('Returns true if the child is valid to given container', () => { - expect(isComponentTypeValidChild(mockInternal, buttonGroupId, ComponentType.Button)).toBe( - true, - ); + it.each([ + ComponentType.ActionButton, + ComponentType.Button, + ComponentType.CustomButton, + ComponentType.NavigationButtons, + ComponentType.PrintButton, + ComponentType.InstantiationButton, + ])('Returns true if the child is valid to given container', (buttonType: ComponentType) => { + expect(isComponentTypeValidChild(mockInternal, buttonGroupId, buttonType)).toBe(true); }); it('Returns true if the component is not dropped inside a container', () => {