From 539a54ce1543f94d435fb0f15136874ff3a5b65f Mon Sep 17 00:00:00 2001 From: Chuns Chen Date: Sat, 24 Dec 2022 10:04:18 +0800 Subject: [PATCH 1/2] fix: expandable row table header is rendered as td and has no top left border radius #39769 --- components/table/style/radius.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/table/style/radius.tsx b/components/table/style/radius.tsx index 85654da87acd..515b37a6e75c 100644 --- a/components/table/style/radius.tsx +++ b/components/table/style/radius.tsx @@ -36,11 +36,11 @@ const genRadiusStyle: GenerateStyle = (token) => { borderStartEndRadius: tableRadius, 'table > thead > tr:first-child': { - 'th:first-child': { + '> *:first-child': { borderStartStartRadius: tableRadius, }, - 'th:last-child': { + '> *:last-child': { borderStartEndRadius: tableRadius, }, }, From 8d30d02eb17b1fa1e54112c3c0ba86282005d52e Mon Sep 17 00:00:00 2001 From: Chuns Chen Date: Sat, 24 Dec 2022 10:08:37 +0800 Subject: [PATCH 2/2] test: update expandIconColumnIndex --- components/table/__tests__/Table.expand.test.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/table/__tests__/Table.expand.test.tsx b/components/table/__tests__/Table.expand.test.tsx index fb521c23b7e4..8ba32fd5a542 100644 --- a/components/table/__tests__/Table.expand.test.tsx +++ b/components/table/__tests__/Table.expand.test.tsx @@ -105,10 +105,10 @@ describe('Table.expand', () => { ); // header has td element (a11y): https://github.com/react-component/table/pull/859 - const tdNodeList = container.querySelectorAll('td'); + const tdNodeList = container.querySelectorAll('tbody td'); - expect(tdNodeList[2].textContent).toEqual('bamboo'); - expect(tdNodeList[3].querySelector('.ant-table-row-expand-icon')).toBeTruthy(); + expect(tdNodeList[0].textContent).toEqual('bamboo'); + expect(tdNodeList[1].querySelector('.ant-table-row-expand-icon')).toBeTruthy(); }); it('work with selection', () => { @@ -123,10 +123,10 @@ describe('Table.expand', () => { rowSelection={{}} />, ); - const tdNodeList = container.querySelectorAll('td'); - expect(tdNodeList[2].querySelector('.ant-checkbox-input')).toBeTruthy(); - expect(tdNodeList[3].textContent).toEqual('bamboo'); - expect(tdNodeList[4].querySelector('.ant-table-row-expand-icon')).toBeTruthy(); + const tdNodeList = container.querySelectorAll('tbody td'); + expect(tdNodeList[0].querySelector('.ant-checkbox-input')).toBeTruthy(); + expect(tdNodeList[1].textContent).toEqual('bamboo'); + expect(tdNodeList[2].querySelector('.ant-table-row-expand-icon')).toBeTruthy(); }); }); });