diff --git a/src/Cell/index.tsx b/src/Cell/index.tsx index 4a2fd57fa..ce727f7ef 100644 --- a/src/Cell/index.tsx +++ b/src/Cell/index.tsx @@ -176,11 +176,13 @@ function Cell(props: CellProps) { } // >>>>> Title - const title = getTitleFromCellRenderChildren({ - rowType, - ellipsis, - children: childNode, - }); + const title = + additionalProps.title ?? + getTitleFromCellRenderChildren({ + rowType, + ellipsis, + children: childNode, + }); // >>>>> ClassName const mergedClassName = classNames( diff --git a/tests/Cell.spec.tsx b/tests/Cell.spec.tsx index a23f3c364..cdd558080 100644 --- a/tests/Cell.spec.tsx +++ b/tests/Cell.spec.tsx @@ -101,4 +101,25 @@ describe('Table.Cell', () => { wrapper.find('button').simulate('click'); expect(wrapper.find('.rc-table-tbody .rc-table-cell').text()).toEqual('2'); }); + + it('onHeaderCell', () => { + const wrapper = mount( + +

NotYet

+ + ), + onHeaderCell: () => ({ + title: 'Bamboo', + }), + }, + ]} + />, + ); + + expect(wrapper.find('thead th').prop('title')).toEqual('Bamboo'); + }); });