mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
fix: Descriptions key prop issue (#44278)
* fix: descriptions throw react key prop error in jsx mode * chore: update test --------- Co-authored-by: MadCcc <1075746765@qq.com>
This commit is contained in:
@@ -320,4 +320,20 @@ describe('Descriptions', () => {
|
||||
const view = nestDesc.querySelector('.ant-descriptions-view');
|
||||
expect(getComputedStyle(view!).border).toBeFalsy();
|
||||
});
|
||||
|
||||
it('Should Descriptions not throw react key prop error in jsx mode', () => {
|
||||
render(
|
||||
<Descriptions title="User Info">
|
||||
<Descriptions.Item key="1" label="UserName">
|
||||
Zhou Maomao
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="Telephone">1810000000</Descriptions.Item>
|
||||
</Descriptions>,
|
||||
);
|
||||
expect(errorSpy).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('`key` is not a prop'),
|
||||
expect.anything(),
|
||||
expect.anything(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ function getFilledItem(
|
||||
|
||||
// Convert children into items
|
||||
const transChildren2Items = (childNodes?: React.ReactNode) =>
|
||||
toArray(childNodes).map((node) => node?.props);
|
||||
toArray(childNodes).map((node) => ({ ...node?.props }));
|
||||
|
||||
// Calculate the sum of span in a row
|
||||
function getCalcRows(rowItems: DescriptionsItemType[], mergedColumn: number) {
|
||||
|
||||
Reference in New Issue
Block a user