File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 2
2
import React from 'react' ;
3
3
import classNames from 'classnames' ;
4
4
5
- const Pager = props => {
5
+ const Pager = ( props ) => {
6
6
const prefixCls = `${ props . rootPrefixCls } -item` ;
7
- const cls = classNames ( prefixCls , `${ prefixCls } -${ props . page } ` , {
8
- [ `${ prefixCls } -active` ] : props . active ,
9
- [ props . className ] : ! ! props . className ,
10
- [ `${ prefixCls } -disabled` ] : ! props . page ,
11
- } ) ;
7
+ const cls = classNames (
8
+ prefixCls ,
9
+ `${ prefixCls } -${ props . page } ` ,
10
+ {
11
+ [ `${ prefixCls } -active` ] : props . active ,
12
+ [ props . className ] : ! ! props . className ,
13
+ [ `${ prefixCls } -disabled` ] : ! props . page ,
14
+ } ,
15
+ props . className ,
16
+ ) ;
12
17
13
18
const handleClick = ( ) => {
14
19
props . onClick ( props . page ) ;
15
20
} ;
16
21
17
- const handleKeyPress = e => {
22
+ const handleKeyPress = ( e ) => {
18
23
props . onKeyPress ( e , props . onClick , props . page ) ;
19
24
} ;
20
25
Original file line number Diff line number Diff line change @@ -509,8 +509,8 @@ class Pagination extends React.Component {
509
509
< Pager
510
510
{ ...pagerProps }
511
511
key = "noPager"
512
- page = { allPages }
513
- className = { `${ prefixCls } -disabled` }
512
+ page = { 1 }
513
+ className = { `${ prefixCls } -item- disabled` }
514
514
/> ,
515
515
) ;
516
516
}
Original file line number Diff line number Diff line change @@ -324,9 +324,10 @@ describe('current value on onShowSizeChange when total is 0', () => {
324
324
) ;
325
325
} ) ;
326
326
327
- it ( 'when total is 0, pager should show and disabled' , ( ) => {
327
+ it ( 'when total is 0, pager should show `1` and being disabled' , ( ) => {
328
328
const itemButton = wrapper . find ( '.rc-pagination-item' ) ;
329
329
expect ( itemButton . hasClass ( 'rc-pagination-item-disabled' ) ) . toBe ( true ) ;
330
+ expect ( itemButton . text ( ) ) . toBe ( '1' ) ;
330
331
} ) ;
331
332
332
333
it ( 'when total is 0, `from` and `to` should be 0' , ( ) => {
You can’t perform that action at this time.
0 commit comments