File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,40 @@ describe('List.Touch', () => {
9494 wrapper . unmount ( ) ;
9595 } ) ;
9696
97+ it ( 'origin scroll' , ( ) => {
98+ const wrapper = genList ( { itemHeight : 20 , height : 100 , data : genData ( 100 ) } ) ;
99+
100+ function getElement ( ) {
101+ return wrapper . find ( '.rc-virtual-list-holder' ) . instance ( ) ;
102+ }
103+
104+ act ( ( ) => {
105+ // start
106+ const touchEvent = new Event ( 'touchstart' ) ;
107+ touchEvent . touches = [ { pageY : 100 } ] ;
108+ getElement ( ) . dispatchEvent ( touchEvent ) ;
109+
110+ // move
111+ const moveEvent1 = new Event ( 'touchmove' ) ;
112+ moveEvent1 . touches = [ { pageY : 110 } ] ;
113+ getElement ( ) . dispatchEvent ( moveEvent1 ) ;
114+
115+ // move
116+ const moveEvent2 = new Event ( 'touchmove' ) ;
117+ moveEvent2 . touches = [ { pageY : 150 } ] ;
118+ getElement ( ) . dispatchEvent ( moveEvent2 ) ;
119+
120+ // end
121+ const endEvent = new Event ( 'touchend' ) ;
122+ getElement ( ) . dispatchEvent ( endEvent ) ;
123+
124+ // smooth
125+ jest . runAllTimers ( ) ;
126+ } ) ;
127+ expect ( wrapper . find ( 'ul' ) . instance ( ) . scrollTop ) . toBe ( 0 ) ;
128+ wrapper . unmount ( ) ;
129+ } ) ;
130+
97131 it ( 'not call when not scroll-able' , ( ) => {
98132 const wrapper = genList ( { itemHeight : 20 , height : 100 , data : genData ( 100 ) } ) ;
99133
You can’t perform that action at this time.
0 commit comments