mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 05:28:20 +08:00
27 lines
749 B
TypeScript
27 lines
749 B
TypeScript
import React from 'react';
|
|
|
|
import Descriptions from '..';
|
|
import { render } from '../../../tests/utils';
|
|
import useBreakpoint from '../../grid/hooks/useBreakpoint';
|
|
import useItems from '../hooks/useItems';
|
|
|
|
describe('Descriptions.Hooks', () => {
|
|
it('Should Descriptions not throw react key prop error in jsx mode', () => {
|
|
const Demo = () => {
|
|
const screens = useBreakpoint();
|
|
const items = useItems(
|
|
screens,
|
|
undefined,
|
|
<Descriptions.Item key="bamboo" label="UserName">
|
|
Bamboo
|
|
</Descriptions.Item>,
|
|
);
|
|
|
|
return <p>{(items[0] as any).key}</p>;
|
|
};
|
|
|
|
const { container } = render(<Demo />);
|
|
expect(container.querySelector('p')?.textContent).toBe('bamboo');
|
|
});
|
|
});
|