@@ -249,12 +249,12 @@ describe('vue-infinite-loading', () => {
249249 vm . $mount ( '#app' ) ;
250250 } ) ;
251251
252- it ( 'should works properly with scroll plugins through the `infinite-wrapper` attribute ' , ( done ) => {
252+ it ( 'should works properly with scroll plugins through the `infinite-wrapper` property ' , ( done ) => {
253253 const app = document . getElementById ( 'app' ) ;
254254 const wrapper = document . createElement ( 'div' ) ;
255255
256256 app . appendChild ( wrapper ) ;
257- app . setAttribute ( 'infinite-wrapper' , '' ) ; // add `infinite-wrapper` attribute for app container
257+ app . setAttribute ( 'infinite-wrapper' , '' ) ; // add `infinite-wrapper` property for app container
258258 vm = new Vue ( Object . assign ( { } , basicConfig , {
259259 methods : {
260260 infiniteHandler : function infiniteHandler ( ) {
@@ -460,7 +460,7 @@ describe('vue-infinite-loading', () => {
460460 vm . $mount ( '#app' ) ;
461461 } ) ;
462462
463- it ( 'should find my forcible element as scroll wrapper when using `force-use-infinite-wrapper` attribute ' , ( done ) => {
463+ it ( 'should find my forcible element as scroll wrapper when using `force-use-infinite-wrapper` property ' , ( done ) => {
464464 vm = new Vue ( Object . assign ( { } , basicConfig , {
465465 template : `
466466 <div infinite-wrapper>
@@ -536,4 +536,34 @@ describe('vue-infinite-loading', () => {
536536
537537 vm . $mount ( '#app' ) ;
538538 } ) ;
539+
540+ it ( 'should search scroll wrapper again when change the `force-use-infinite-wrapper` property' , ( done ) => {
541+ vm = new Vue ( Object . assign ( { } , basicConfig , {
542+ data : {
543+ forceUseInfiniteWrapper : true ,
544+ } ,
545+ template : `
546+ <div infinite-wrapper>
547+ <div style="overflow: auto;">
548+ <infinite-loading
549+ :force-use-infinite-wrapper="forceUseInfiniteWrapper"
550+ @infinite="infiniteHandler"
551+ ref="infiniteLoading"
552+ >
553+ </infinite-loading>
554+ </div>
555+ </div>
556+ ` ,
557+ mounted : function mounted ( ) {
558+ expect ( this . $refs . infiniteLoading . scrollParent ) . to . equal ( this . $el ) ;
559+ this . forceUseInfiniteWrapper = false ;
560+ this . $nextTick ( ( ) => {
561+ expect ( this . $refs . infiniteLoading . scrollParent ) . to . equal ( this . $el . querySelector ( 'div' ) ) ;
562+ done ( ) ;
563+ } ) ;
564+ } ,
565+ } ) ) ;
566+
567+ vm . $mount ( '#app' ) ;
568+ } ) ;
539569} ) ;
0 commit comments