File tree Expand file tree Collapse file tree 4 files changed +48
-23
lines changed Expand file tree Collapse file tree 4 files changed +48
-23
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ function onChange(current, pageSize) {
1717
1818const App = ( ) => (
1919 < >
20+ < h3 > 默认</ h3 >
2021 < Pagination
2122 selectComponentClass = { Select }
2223 showQuickJumper
@@ -27,10 +28,10 @@ const App = () => (
2728 onChange = { onChange }
2829 total = { 450 }
2930 />
30- < br / >
31+ < h3 > 禁用 </ h3 >
3132 < Pagination
3233 selectComponentClass = { Select }
33- showQuickJumper = { { goButton : true } }
34+ showQuickJumper
3435 showSizeChanger
3536 defaultPageSize = { 20 }
3637 defaultCurrent = { 5 }
@@ -39,6 +40,25 @@ const App = () => (
3940 total = { 450 }
4041 disabled
4142 />
43+ < h3 > 单页默认隐藏</ h3 >
44+ < Pagination
45+ selectComponentClass = { Select }
46+ showQuickJumper
47+ showSizeChanger
48+ onShowSizeChange = { onShowSizeChange }
49+ onChange = { onChange }
50+ total = { 8 }
51+ />
52+ < br />
53+ < Pagination
54+ selectComponentClass = { Select }
55+ showQuickJumper
56+ showSizeChanger
57+ onShowSizeChange = { onShowSizeChange }
58+ onChange = { onChange }
59+ pageSize = { 10 }
60+ total = { 8 }
61+ />
4262 </ >
4363) ;
4464
Original file line number Diff line number Diff line change @@ -185,7 +185,8 @@ class Pagination extends React.Component {
185185 } ;
186186
187187 shouldDisplayQuickJumper = ( ) => {
188- const { showQuickJumper, pageSize, total } = this . props ;
188+ const { showQuickJumper, total } = this . props ;
189+ const { pageSize } = this . state ;
189190 if ( total <= pageSize ) {
190191 return false ;
191192 }
Original file line number Diff line number Diff line change @@ -192,4 +192,28 @@ describe('simple quick jumper', () => {
192192 wrapper . find ( '.rc-pagination-options-quick-jumper-button' ) . exists ( ) ,
193193 ) . toBe ( false ) ;
194194 } ) ;
195+
196+ it ( 'Quick Jumper should hide when only one page' , ( ) => {
197+ wrapper = mount (
198+ < Pagination onChange = { onChange } total = { 5 } showQuickJumper /> ,
199+ ) ;
200+ expect ( wrapper . find ( '.rc-pagination-options-quick-jumper' ) . exists ( ) ) . toBe (
201+ false ,
202+ ) ;
203+ } ) ;
204+
205+ // https://github.com/ant-design/ant-design/issues/32991
206+ it ( 'Quick Jumper should hide when only one page when has pageSize' , ( ) => {
207+ wrapper = mount (
208+ < Pagination
209+ onChange = { onChange }
210+ total = { 5 }
211+ pageSize = { 10 }
212+ showQuickJumper
213+ /> ,
214+ ) ;
215+ expect ( wrapper . find ( '.rc-pagination-options-quick-jumper' ) . exists ( ) ) . toBe (
216+ false ,
217+ ) ;
218+ } ) ;
195219} ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments