File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,14 @@ import LOCALE from './locale/zh_CN';
88
99function noop ( ) { }
1010
11- function isInteger ( value ) {
11+ function isInteger ( v ) {
12+ const value = Number ( v ) ;
1213 return (
1314 // eslint-disable-next-line no-restricted-globals
14- typeof value === 'number' && isFinite ( value ) && Math . floor ( value ) === value
15+ typeof value === 'number' &&
16+ ! isNaN ( value ) &&
17+ isFinite ( value ) &&
18+ Math . floor ( value ) === value
1519 ) ;
1620}
1721
Original file line number Diff line number Diff line change @@ -416,3 +416,26 @@ describe('current value on onShowSizeChange when total is 0', () => {
416416 expect ( wrapper4 . exists ( '.rc-pagination-options-size-changer' ) ) . toBe ( true ) ;
417417 } ) ;
418418} ) ;
419+
420+ describe ( 'should emit onChange when total is string' , ( ) => {
421+ let wrapper ;
422+ const onChange = jest . fn ( ) ;
423+
424+ beforeEach ( ( ) => {
425+ wrapper = mount (
426+ < Pagination total = "100" pageSize = { 10 } onChange = { onChange } /> ,
427+ ) ;
428+ } ) ;
429+
430+ afterEach ( ( ) => {
431+ wrapper . unmount ( ) ;
432+ onChange . mockReset ( ) ;
433+ } ) ;
434+
435+ it ( 'onChange should be called when click page' , ( ) => {
436+ const pagers = wrapper . find ( '.rc-pagination-item-3' ) ;
437+ const page1 = pagers . at ( 0 ) ;
438+ page1 . simulate ( 'click' ) ;
439+ expect ( onChange ) . toBeCalledWith ( 3 , 10 ) ;
440+ } ) ;
441+ } ) ;
You can’t perform that action at this time.
0 commit comments