From 041bcba206443a7d2b8cf54ba463d612fcb60137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 4 Jan 2023 19:03:42 +0800 Subject: [PATCH 1/2] test: test driven --- tests/Cell.spec.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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'); + }); }); From c65aef2f2b1fca2ed50fb8714fe3867f9ae8cda0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Wed, 4 Jan 2023 19:05:23 +0800 Subject: [PATCH 2/2] fix: title missing --- src/Cell/index.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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(