mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
fix(Descriptions): pass all props to the Descriptions container (#40859)
This commit is contained in:
parent
f9a38af179
commit
40a7e7a142
@ -256,4 +256,15 @@ describe('Descriptions', () => {
|
||||
);
|
||||
expect(wrapper.container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should pass data-* and accessibility attributes', () => {
|
||||
const { getByTestId } = render(
|
||||
<Descriptions data-testid="test-id" data-id="12345" aria-describedby="some-label">
|
||||
<Descriptions.Item label="banana">banana</Descriptions.Item>
|
||||
</Descriptions>,
|
||||
);
|
||||
const container = getByTestId('test-id');
|
||||
expect(container).toHaveAttribute('data-id', '12345');
|
||||
expect(container).toHaveAttribute('aria-describedby', 'some-label');
|
||||
});
|
||||
});
|
||||
|
@ -130,6 +130,7 @@ function Descriptions({
|
||||
size,
|
||||
labelStyle,
|
||||
contentStyle,
|
||||
...restProps
|
||||
}: DescriptionsProps) {
|
||||
const { getPrefixCls, direction } = React.useContext(ConfigContext);
|
||||
const prefixCls = getPrefixCls('descriptions', customizePrefixCls);
|
||||
@ -175,6 +176,7 @@ function Descriptions({
|
||||
hashId,
|
||||
)}
|
||||
style={style}
|
||||
{...restProps}
|
||||
>
|
||||
{(title || extra) && (
|
||||
<div className={`${prefixCls}-header`}>
|
||||
|
Loading…
Reference in New Issue
Block a user