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) {
17
17
18
18
const App = ( ) => (
19
19
< >
20
+ < h3 > 默认</ h3 >
20
21
< Pagination
21
22
selectComponentClass = { Select }
22
23
showQuickJumper
@@ -27,10 +28,10 @@ const App = () => (
27
28
onChange = { onChange }
28
29
total = { 450 }
29
30
/>
30
- < br / >
31
+ < h3 > 禁用 </ h3 >
31
32
< Pagination
32
33
selectComponentClass = { Select }
33
- showQuickJumper = { { goButton : true } }
34
+ showQuickJumper
34
35
showSizeChanger
35
36
defaultPageSize = { 20 }
36
37
defaultCurrent = { 5 }
@@ -39,6 +40,25 @@ const App = () => (
39
40
total = { 450 }
40
41
disabled
41
42
/>
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
+ />
42
62
</ >
43
63
) ;
44
64
Original file line number Diff line number Diff line change @@ -185,7 +185,8 @@ class Pagination extends React.Component {
185
185
} ;
186
186
187
187
shouldDisplayQuickJumper = ( ) => {
188
- const { showQuickJumper, pageSize, total } = this . props ;
188
+ const { showQuickJumper, total } = this . props ;
189
+ const { pageSize } = this . state ;
189
190
if ( total <= pageSize ) {
190
191
return false ;
191
192
}
Original file line number Diff line number Diff line change @@ -192,4 +192,28 @@ describe('simple quick jumper', () => {
192
192
wrapper . find ( '.rc-pagination-options-quick-jumper-button' ) . exists ( ) ,
193
193
) . toBe ( false ) ;
194
194
} ) ;
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
+ } ) ;
195
219
} ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments