From c0304cca55a9a5e0fb4b801836373b85fb72a1cf Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 30 Mar 2022 16:38:08 +0800 Subject: [PATCH] fix: Pagination should display middle size Select when ConfigProvider componentSize is large (#34756) * fix: Pagination should display middle size Select when ConfigProvider componentSize is large close #34744 * fix snapshot --- .../__snapshots__/components.test.js.snap | 2 +- components/pagination/MiniSelect.tsx | 12 - components/pagination/Pagination.tsx | 6 +- components/pagination/Select.tsx | 16 + .../__snapshots__/index.test.js.snap | 362 ++++++++++++++---- components/pagination/__tests__/index.test.js | 32 +- 6 files changed, 319 insertions(+), 111 deletions(-) delete mode 100644 components/pagination/MiniSelect.tsx create mode 100644 components/pagination/Select.tsx diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index ef087a578f..9c8f2f73c5 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -16633,7 +16633,7 @@ exports[`ConfigProvider components Pagination configProvider componentSize large >
{ - Option: typeof Select.Option; -} - -const MiniSelect: MiniSelectInterface = props => ; +const MiddleSelect: MiniOrMiddleSelectInterface = props => + + + 10 / page + +
+ +
+ + +`; + +exports[`Pagination rtl render component should be rendered correctly in RTL direction 1`] = ` + +`; diff --git a/components/pagination/__tests__/index.test.js b/components/pagination/__tests__/index.test.js index 6e2271124a..0b872df83e 100644 --- a/components/pagination/__tests__/index.test.js +++ b/components/pagination/__tests__/index.test.js @@ -1,5 +1,5 @@ import React from 'react'; -import { render, mount } from 'enzyme'; +import { mount } from 'enzyme'; import Pagination from '..'; import Select from '../../select'; import ConfigProvider from '../../config-provider'; @@ -10,15 +10,6 @@ describe('Pagination', () => { mountTest(Pagination); rtlTest(Pagination); - it('should be rendered correctly in RTL', () => { - const wrapper = mount( - - - , - ); - expect(render(wrapper)).toMatchSnapshot(); - }); - it('should pass disabled to prev and next buttons', () => { const itemRender = (current, type, originalElement) => { if (type === 'prev') { @@ -69,4 +60,25 @@ describe('Pagination', () => { ); expect(wrapper.find('.custom-select').length).toBeTruthy(); }); + + describe('ConfigProvider', () => { + it('should be rendered correctly in RTL', () => { + const wrapper = mount( + + + , + ); + expect(wrapper.render()).toMatchSnapshot(); + }); + + it('should be rendered correctly when componentSize is large', () => { + const wrapper = mount( + + + , + ); + expect(wrapper.render()).toMatchSnapshot(); + expect(wrapper.find('.ant-select-lg').length).toBe(0); + }); + }); });