mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
feat(radioGroup): support data-* and aria-* props (#30507)
close #30501
This commit is contained in:
parent
1bcb123035
commit
04479b8e6c
@ -192,4 +192,15 @@ describe('Radio Group', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should support data-* or aria-* props', () => {
|
||||
const wrapper = mount(
|
||||
createRadioGroup({
|
||||
'data-radio-group-id': 'radio-group-id',
|
||||
'aria-label': 'radio-group',
|
||||
}),
|
||||
);
|
||||
expect(wrapper.getDOMNode().getAttribute('data-radio-group-id')).toBe('radio-group-id');
|
||||
expect(wrapper.getDOMNode().getAttribute('aria-label')).toBe('radio-group');
|
||||
});
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ import { RadioGroupProps, RadioChangeEvent, RadioGroupButtonStyle } from './inte
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import SizeContext from '../config-provider/SizeContext';
|
||||
import { RadioGroupContextProvider } from './context';
|
||||
import getDataOrAriaProps from '../_util/getDataOrAriaProps';
|
||||
|
||||
const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>((props, ref) => {
|
||||
const { getPrefixCls, direction } = React.useContext(ConfigContext);
|
||||
@ -91,6 +92,7 @@ const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>((props, ref
|
||||
);
|
||||
return (
|
||||
<div
|
||||
{...getDataOrAriaProps(props)}
|
||||
className={classString}
|
||||
style={style}
|
||||
onMouseEnter={onMouseEnter}
|
||||
|
Loading…
Reference in New Issue
Block a user