diff --git a/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.spec.tsx b/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.spec.tsx index ae1c8603782..83bf5d8ded4 100644 --- a/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/RadioButtonGroupInput.spec.tsx @@ -57,6 +57,28 @@ describe('', () => { ).toBeTruthy(); }); + it('should work correctly when ids are numbers', () => { + const choices = [ + { id: 1, name: 'VISA' }, + { id: 2, name: 'Mastercard' }, + ]; + const { getByLabelText } = render( +
( + + )} + /> + ); + const input = getByLabelText('Mastercard') as HTMLInputElement; + expect(input.checked).toBe(false); + fireEvent.click(input); + expect(input.checked).toBe(true); + }); + it('should use optionValue as value identifier', () => { const { getByLabelText } = render( } + control={ + onChange(value)} + {...inputProps} + /> + } /> ); };