@@ -128,6 +128,49 @@ describe('List.Touch', () => {
128128 wrapper . unmount ( ) ;
129129 } ) ;
130130
131+ it ( 'origin scroll' , ( ) => {
132+ const wrapper = genList ( { itemHeight : 20 , height : 100 , data : genData ( 100 ) } ) ;
133+
134+ function getElement ( ) {
135+ return wrapper . find ( '.rc-virtual-list-holder' ) . instance ( ) ;
136+ }
137+
138+ // start
139+ const touchEvent = new Event ( 'touchstart' ) ;
140+ touchEvent . touches = [ { pageY : 100 } ] ;
141+ getElement ( ) . dispatchEvent ( touchEvent ) ;
142+
143+ // move
144+ const moveEvent1 = new Event ( 'touchmove' ) ;
145+ moveEvent1 . touches = [ { pageY : 110 } ] ;
146+ getElement ( ) . dispatchEvent ( moveEvent1 ) ;
147+
148+ // move
149+ const moveEvent2 = new Event ( 'touchmove' ) ;
150+ moveEvent2 . touches = [ { pageY : 150 } ] ;
151+ getElement ( ) . dispatchEvent ( moveEvent2 ) ;
152+
153+ // move
154+ const moveEvent3 = new Event ( 'touchmove' ) ;
155+ moveEvent3 . touches = [ { pageY : 20 } ] ;
156+ getElement ( ) . dispatchEvent ( moveEvent3 ) ;
157+
158+ // move
159+ const moveEvent4 = new Event ( 'touchmove' ) ;
160+ moveEvent4 . touches = [ { pageY : 100 } ] ;
161+ getElement ( ) . dispatchEvent ( moveEvent4 ) ;
162+
163+ // end
164+ const endEvent = new Event ( 'touchend' ) ;
165+ getElement ( ) . dispatchEvent ( endEvent ) ;
166+
167+ // smooth
168+ jest . runAllTimers ( ) ;
169+
170+ expect ( wrapper . find ( 'ul' ) . instance ( ) . scrollTop ) . toBe ( 0 ) ;
171+ wrapper . unmount ( ) ;
172+ } ) ;
173+
131174 it ( 'not call when not scroll-able' , ( ) => {
132175 const wrapper = genList ( { itemHeight : 20 , height : 100 , data : genData ( 100 ) } ) ;
133176
0 commit comments