File tree Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -35,16 +35,16 @@ class Options extends React.Component {
3535 if ( goButton || goInputText === '' ) {
3636 return ;
3737 }
38+ this . setState ( {
39+ goInputText : '' ,
40+ } ) ;
3841 if (
3942 e . relatedTarget &&
40- ( e . relatedTarget . className . indexOf ( `${ rootPrefixCls } -prev ` ) >= 0 ||
41- e . relatedTarget . className . indexOf ( `${ rootPrefixCls } -next ` ) >= 0 )
43+ ( e . relatedTarget . className . indexOf ( `${ rootPrefixCls } -item-link ` ) >= 0 ||
44+ e . relatedTarget . className . indexOf ( `${ rootPrefixCls } -item ` ) >= 0 )
4245 ) {
4346 return ;
4447 }
45- this . setState ( {
46- goInputText : '' ,
47- } ) ;
4848 quickGo ( this . getValidValue ( ) ) ;
4949 } ;
5050
@@ -122,7 +122,7 @@ class Options extends React.Component {
122122 dropdownMatchSelectWidth = { false }
123123 value = { ( pageSize || pageSizeOptions [ 0 ] ) . toString ( ) }
124124 onChange = { this . changeSize }
125- getPopupContainer = { triggerNode => triggerNode . parentNode }
125+ getPopupContainer = { ( triggerNode ) => triggerNode . parentNode }
126126 >
127127 { options }
128128 </ Select >
Original file line number Diff line number Diff line change @@ -38,6 +38,34 @@ describe('Pagination with jumper', () => {
3838 expect ( wrapper . state ( ) . current ) . toBe ( 10 ) ;
3939 expect ( onChange ) . not . toBeCalled ( ) ;
4040 } ) ;
41+
42+ it ( 'should not jumper when click pre/next button' , ( ) => {
43+ const quickJumper = wrapper . find ( '.rc-pagination-options-quick-jumper' ) ;
44+ const input = quickJumper . find ( 'input' ) ;
45+ input . simulate ( 'change' , { target : { value : '13' } } ) ;
46+ const mockEvent = {
47+ relatedTarget : {
48+ className : 'rc-pagination-item-link' ,
49+ } ,
50+ } ;
51+ input . simulate ( 'blur' , mockEvent ) ;
52+ expect ( input . instance ( ) . value ) . toBe ( '' ) ;
53+ expect ( onChange ) . not . toBeCalled ( ) ;
54+ } ) ;
55+
56+ it ( 'should not jumper when click page' , ( ) => {
57+ const quickJumper = wrapper . find ( '.rc-pagination-options-quick-jumper' ) ;
58+ const input = quickJumper . find ( 'input' ) ;
59+ input . simulate ( 'change' , { target : { value : '13' } } ) ;
60+ const mockEvent = {
61+ relatedTarget : {
62+ className : 'rc-pagination-item' ,
63+ } ,
64+ } ;
65+ input . simulate ( 'blur' , mockEvent ) ;
66+ expect ( input . instance ( ) . value ) . toBe ( '' ) ;
67+ expect ( onChange ) . not . toBeCalled ( ) ;
68+ } ) ;
4169} ) ;
4270
4371describe ( 'simple quick jumper' , ( ) => {
You can’t perform that action at this time.
0 commit comments