diff --git a/components/table/__tests__/Table.sorter.test.tsx b/components/table/__tests__/Table.sorter.test.tsx index 8b4c09211437..e11a613a111a 100644 --- a/components/table/__tests__/Table.sorter.test.tsx +++ b/components/table/__tests__/Table.sorter.test.tsx @@ -321,6 +321,21 @@ describe('Table.sorter', () => { expect(container.querySelector('.ant-tooltip-open')).toBeTruthy(); fireEvent.mouseOut(container.querySelector('.ant-table-column-sorters')!); + // should merge original title into showSorterTooltip object + rerender( + createTable({ + showSorterTooltip: { + overlayClassName: 'custom-tooltip', + }, + }), + ); + fireEvent.mouseEnter(container.querySelector('.ant-table-column-sorters')!); + act(() => { + jest.runAllTimers(); + }); + expect(container.querySelector('.ant-tooltip-open')).toBeTruthy(); + fireEvent.mouseOut(container.querySelector('.ant-table-column-sorters')!); + // Root to false rerender(createTable({ showSorterTooltip: false })); act(() => { diff --git a/components/table/hooks/useSorter.tsx b/components/table/hooks/useSorter.tsx index c2551decd19a..6937c6855c62 100644 --- a/components/table/hooks/useSorter.tsx +++ b/components/table/hooks/useSorter.tsx @@ -168,7 +168,12 @@ function injectSorter( sortTip = triggerAsc; } const tooltipProps: TooltipProps = - typeof showSorterTooltip === 'object' ? showSorterTooltip : { title: sortTip }; + typeof showSorterTooltip === 'object' + ? { + title: sortTip, + ...showSorterTooltip, + } + : { title: sortTip }; newColumn = { ...newColumn, className: classNames(newColumn.className, { [`${prefixCls}-column-sort`]: sortOrder }),