diff --git a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap index d31be9b7e38a..1e4613b07dcc 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap @@ -26765,7 +26765,7 @@ exports[`ConfigProvider components Table configProvider 1`] = ` Submenu { ); errorSpy.mockRestore(); }); + + it('expandIconClassName', () => { + const { container } = render( + } + inlineCollapsed + items={[ + { + label: 'Option 1', + key: '1', + icon: '112', + children: [ + { + label: 'Option 1-1', + key: '1-1', + }, + ], + }, + ]} + />, + ); + expect(container.querySelector('.custom-expand-icon')).toBeTruthy(); + }); + + // https://github.com/ant-design/ant-design/issues/40041 + it('should not show icon when inlineCollapsed', () => { + const { container } = render( + I} + inlineCollapsed + items={[ + { + label: 'Option 1', + key: '1', + icon: '112', + children: [ + { + label: 'Option 1-1', + key: '1-1', + }, + ], + }, + ]} + />, + ); + + expect(container.querySelector('.bamboo')).toBeTruthy(); + expect(getComputedStyle(container.querySelector('.bamboo') as HTMLElement)).toHaveProperty( + 'opacity', + '0', + ); + }); }); diff --git a/components/menu/menu.tsx b/components/menu/menu.tsx index 1600476deb2f..7f0e0e052d81 100644 --- a/components/menu/menu.tsx +++ b/components/menu/menu.tsx @@ -125,8 +125,9 @@ const InternalMenu = forwardRef((props, ref) => { if (typeof expandIcon === 'function') { mergedExpandIcon = expandIcon; } else { - mergedExpandIcon = cloneElement(expandIcon || overrideObj.expandIcon, { - className: `${prefixCls}-submenu-expand-icon`, + const beClone: any = expandIcon || overrideObj.expandIcon; + mergedExpandIcon = cloneElement(beClone, { + className: classNames(`${prefixCls}-submenu-expand-icon`, beClone?.props?.className), }); } diff --git a/components/menu/style/vertical.tsx b/components/menu/style/vertical.tsx index ce7533a0f35a..aa5dd0bb2fe0 100644 --- a/components/menu/style/vertical.tsx +++ b/components/menu/style/vertical.tsx @@ -184,7 +184,10 @@ const getVerticalStyle: GenerateStyle = (token) => { paddingInline: `calc(50% - ${fontSizeSM}px)`, textOverflow: 'clip', - [`${componentCls}-submenu-arrow`]: { + [` + ${componentCls}-submenu-arrow, + ${componentCls}-submenu-expand-icon + `]: { opacity: 0, }, diff --git a/components/table/__tests__/__snapshots__/Table.filter.test.tsx.snap b/components/table/__tests__/__snapshots__/Table.filter.test.tsx.snap index b6892c6a8bef..f2342a4eb9b5 100644 --- a/components/table/__tests__/__snapshots__/Table.filter.test.tsx.snap +++ b/components/table/__tests__/__snapshots__/Table.filter.test.tsx.snap @@ -645,7 +645,7 @@ exports[`Table.filter renders menu correctly 1`] = ` Title