@@ -96,19 +96,21 @@ describe('InfiniteLoading.vue', () => {
9696 it ( 'should not to execute callback if the previous loading has not be completed' , ( done ) => {
9797 vm . onInfinite = function test ( ) {
9898 const len = this . list . length + 1 ;
99+ const infiniteWrapper = this . $refs . infiniteLoading . scrollParent ;
100+
99101 for ( let i = len ; i < len + 20 ; i ++ ) {
100102 this . list . push ( i ) ;
101103 }
102104
103105 Vue . nextTick ( ( ) => {
104106 if ( this . list . length === 20 ) {
105- vm . $el . addEventListener ( 'scroll' , ( ) => {
107+ infiniteWrapper . addEventListener ( 'scroll' , ( ) => {
106108 expect ( this . list ) . to . have . lengthOf ( 20 ) ;
107109 done ( ) ;
108110 } ) ;
109111
110112 // trigger scroll event manually
111- vm . $el . scrollTop = vm . $el . scrollHeight ;
113+ infiniteWrapper . scrollTop = infiniteWrapper . scrollHeight ;
112114 }
113115 } ) ;
114116 } . bind ( vm ) ;
@@ -259,4 +261,21 @@ describe('InfiniteLoading.vue', () => {
259261
260262 app . $mount ( '#app' ) ;
261263 } ) ;
264+
265+ it ( 'should work with customize scroll plugin like iScroll' , ( done ) => {
266+ const infiniteWrapper = document . createElement ( 'div' ) ;
267+ const wrapper = document . createElement ( 'div' ) ;
268+
269+ vm . isDivScroll = false ;
270+ infiniteWrapper . setAttribute ( 'infinite-wrapper' , '' ) ;
271+ document . getElementById ( 'app' ) . appendChild ( infiniteWrapper ) ;
272+ infiniteWrapper . appendChild ( wrapper ) ;
273+
274+ vm . $mount ( wrapper ) ;
275+
276+ Vue . nextTick ( ( ) => {
277+ expect ( vm . $refs . infiniteLoading . scrollParent ) . to . equal ( infiniteWrapper ) ;
278+ done ( ) ;
279+ } , 1 ) ;
280+ } ) ;
262281} ) ;
0 commit comments