Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Description children missing key
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters