From 9d671ed93907ccb4ffd99e31b61dc052b3f6ef8e Mon Sep 17 00:00:00 2001 From: Chuns Chen Date: Sat, 24 Dec 2022 14:14:07 +0800 Subject: [PATCH] fix: table expandable row header has no top left border radius (#39781) * fix: expandable row table header is rendered as td and has no top left border radius #39769 * test: update expandIconColumnIndex --- components/table/__tests__/Table.expand.test.tsx | 14 +++++++------- components/table/style/radius.tsx | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/table/__tests__/Table.expand.test.tsx b/components/table/__tests__/Table.expand.test.tsx index fb521c23b7..8ba32fd5a5 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(); }); }); }); diff --git a/components/table/style/radius.tsx b/components/table/style/radius.tsx index 85654da87a..515b37a6e7 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, }, },