@@ -249,12 +249,12 @@ describe('vue-infinite-loading', () => {
249
249
vm . $mount ( '#app' ) ;
250
250
} ) ;
251
251
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 ) => {
253
253
const app = document . getElementById ( 'app' ) ;
254
254
const wrapper = document . createElement ( 'div' ) ;
255
255
256
256
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
258
258
vm = new Vue ( Object . assign ( { } , basicConfig , {
259
259
methods : {
260
260
infiniteHandler : function infiniteHandler ( ) {
@@ -460,7 +460,7 @@ describe('vue-infinite-loading', () => {
460
460
vm . $mount ( '#app' ) ;
461
461
} ) ;
462
462
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 ) => {
464
464
vm = new Vue ( Object . assign ( { } , basicConfig , {
465
465
template : `
466
466
<div infinite-wrapper>
@@ -536,4 +536,34 @@ describe('vue-infinite-loading', () => {
536
536
537
537
vm . $mount ( '#app' ) ;
538
538
} ) ;
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
+ } ) ;
539
569
} ) ;
0 commit comments