diff --git a/components/table/Table.tsx b/components/table/Table.tsx index 30d411ce43..c527947b8b 100644 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -148,9 +148,11 @@ function Table(props: TableProps) { const tableProps = omit(props, ['className', 'style', 'columns']) as TableProps; const size = React.useContext(SizeContext); - const { locale: contextLocale = defaultLocale, renderEmpty, direction } = React.useContext( - ConfigContext, - ); + const { + locale: contextLocale = defaultLocale, + renderEmpty, + direction, + } = React.useContext(ConfigContext); const mergedSize = customizeSize || size; const tableLocale = { ...contextLocale.Table, ...locale } as TableLocale; const rawData: readonly RecordType[] = dataSource || EMPTY_LIST; @@ -263,10 +265,10 @@ function Table(props: TableProps) { tableLocale, showSorterTooltip, }); - const sortedData = React.useMemo(() => getSortData(rawData, sortStates, childrenColumnName), [ - rawData, - sortStates, - ]); + const sortedData = React.useMemo( + () => getSortData(rawData, sortStates, childrenColumnName), + [rawData, sortStates], + ); changeEventInfo.sorter = getSorters(); changeEventInfo.sorterStates = sortStates; @@ -432,8 +434,11 @@ function Table(props: TableProps) { const renderPagination = (position: string) => ( ); diff --git a/components/table/__tests__/Table.pagination.test.js b/components/table/__tests__/Table.pagination.test.js index 343ae2ab17..336d23f86c 100644 --- a/components/table/__tests__/Table.pagination.test.js +++ b/components/table/__tests__/Table.pagination.test.js @@ -535,4 +535,22 @@ describe('Table.pagination', () => { wrapper.find('.ant-pagination-item-2').simulate('click'); expect(wrapper.find('.ant-pagination-total-text')).toHaveLength(0); }); + + it('should preserve table pagination className', () => { + const wrapper = mount( + , + ); + expect(wrapper.find('.ant-pagination').prop('className')).toEqual( + 'ant-pagination ant-table-pagination ant-table-pagination-right pagination', + ); + }); }); diff --git a/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap b/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap index fd44a8a0d4..8f6e360af9 100644 --- a/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap @@ -230,7 +230,7 @@ exports[`Table.pagination renders pagination correctly 1`] = `