fix(Breadcrumb): fix wrong overlay deprecation warning in Dropdown when use Breadcrumb with menu props (#40211)

* fix(Breadcrumb): wrong overlay deprecation warning in Dropdown when use Breadcrumb with menu props

* fix(Breadcrumb): fix wrong overlay deprecation warning in Dropdown when use Breadcrumb with menu props
pull/40314/head
ChenXiao 2 years ago committed by GitHub
parent 3892ce3c6d
commit 0e9623ccb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,8 +48,14 @@ const BreadcrumbItem: CompoundedComponent = (props) => {
/** If overlay is have Wrap a Dropdown */
const renderBreadcrumbNode = (breadcrumbItem: React.ReactNode) => {
if (menu || overlay) {
const mergeDropDownProps: DropdownProps = {
...dropdownProps,
};
if ('overlay' in props) {
mergeDropDownProps.overlay = overlay;
}
return (
<Dropdown menu={menu} overlay={overlay} placement="bottom" {...dropdownProps}>
<Dropdown menu={menu} placement="bottom" {...mergeDropDownProps}>
<span className={`${prefixCls}-overlay-link`}>
{breadcrumbItem}
<DownOutlined />

@ -46,6 +46,30 @@ describe('Breadcrumb', () => {
);
});
// https://github.com/ant-design/ant-design/issues/40204
it('wrong overlay deprecation warning in Dropdown', () => {
const items = [
{
key: '1',
label: (
<a target="_blank" rel="noopener noreferrer" href="http://www.alipay.com/">
General
</a>
),
},
];
render(
<Breadcrumb>
<Breadcrumb.Item menu={{ items }}>
<a href="">General</a>
</Breadcrumb.Item>
</Breadcrumb>,
);
expect(errorSpy).not.toHaveBeenCalledWith(
'Warning: [antd: Dropdown] `overlay` is deprecated. Please use `menu` instead.',
);
});
// https://github.com/ant-design/ant-design/issues/5015
it('should allow Breadcrumb.Item is null or undefined', () => {
const { asFragment } = render(

Loading…
Cancel
Save