File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -405,4 +405,32 @@ describe('vue-infinite-loading', () => {
405405
406406 vm . $mount ( '#app' ) ;
407407 } ) ;
408+
409+ it ( 'should still works properly with the $refs.component.$emit but through warning' , ( done ) => {
410+ const originalError = console . warn ;
411+ let throughWarnTimes = 0 ;
412+
413+ console . warn = ( text ) => {
414+ if ( text . indexOf ( '$state' ) > - 1 ) {
415+ throughWarnTimes += 1 ;
416+ }
417+ } ;
418+
419+ vm = new Vue ( Object . assign ( { } , basicConfig , {
420+ methods : {
421+ infiniteHandler : function infiniteHandler ( ) {
422+ if ( ! throughWarnTimes ) {
423+ this . $refs . infiniteLoading . $emit ( '$InfiniteLoading:loaded' ) ;
424+ } else {
425+ this . $refs . infiniteLoading . $emit ( '$InfiniteLoading:complete' ) ;
426+ expect ( throughWarnTimes ) . to . equal ( 2 ) ;
427+ console . warn = originalError ;
428+ done ( ) ;
429+ }
430+ } ,
431+ } ,
432+ } ) ) ;
433+
434+ vm . $mount ( '#app' ) ;
435+ } ) ;
408436} ) ;
You can’t perform that action at this time.
0 commit comments