File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -320,4 +320,45 @@ describe('vue-infinite-loading', () => {
320
320
321
321
vm . $mount ( '#app' ) ;
322
322
} ) ;
323
+
324
+ it ( 'should support hide load result through blank slots' , ( done ) => {
325
+ let calledTimes = 0 ;
326
+
327
+ vm = new Vue ( Object . assign ( { } , basicConfig , {
328
+ methods : {
329
+ infiniteHandler : function infiniteHandler ( ) {
330
+ if ( calledTimes ) {
331
+ this . $refs . infiniteLoading . $emit ( '$InfiniteLoading:load' ) ;
332
+ this . $refs . infiniteLoading . $emit ( '$InfiniteLoading:complete' ) ;
333
+ this . $nextTick ( ( ) => {
334
+ // check for no-more result display
335
+ expect ( isShow ( this . $el . querySelectorAll ( '.infinite-status-prompt' ) [ 1 ] ) ) . to . be . false ;
336
+ done ( ) ;
337
+ } ) ;
338
+ } else {
339
+ calledTimes += 1 ;
340
+ this . $refs . infiniteLoading . $emit ( '$InfiniteLoading:complete' ) ;
341
+ this . $nextTick ( ( ) => {
342
+ // check for no-result result display
343
+ expect ( isShow ( this . $el . querySelectorAll ( '.infinite-status-prompt' ) [ 0 ] ) ) . to . be . false ;
344
+
345
+ // reset component to check no-more status
346
+ this . $refs . infiniteLoading . $emit ( '$InfiniteLoading:reset' ) ;
347
+ } ) ;
348
+ }
349
+ } ,
350
+ } ,
351
+ template : `
352
+ <infinite-loading
353
+ @infinite="infiniteHandler"
354
+ ref="infiniteLoading"
355
+ >
356
+ <span slot="no-results"></span>
357
+ <span slot="no-more"></span>
358
+ </infinite-loading>
359
+ ` ,
360
+ } ) ) ;
361
+
362
+ vm . $mount ( '#app' ) ;
363
+ } ) ;
323
364
} ) ;
You can’t perform that action at this time.
0 commit comments