@@ -119,7 +119,7 @@ describe('vue-infinite-loading:component', () => {
119
119
120
120
if ( isComplete ) {
121
121
// check no more text
122
- expect ( isShow ( this . $el . querySelectorAll ( '.infinite-status-prompt' ) [ 1 ] ) ) . to . be . true ;
122
+ expect ( isShow ( this . $el . querySelector ( '.infinite-status-prompt:nth-child(3)' ) ) ) . to . be . true ;
123
123
done ( ) ;
124
124
}
125
125
} ) ;
@@ -179,7 +179,7 @@ describe('vue-infinite-loading:component', () => {
179
179
$state . complete ( ) ;
180
180
this . $nextTick ( ( ) => {
181
181
// check no results text
182
- expect ( isShow ( this . $el . querySelectorAll ( '.infinite-status-prompt' ) [ 0 ] ) ) . to . be . true ;
182
+ expect ( isShow ( this . $el . querySelector ( '.infinite-status-prompt:nth-child(2)' ) ) ) . to . be . true ;
183
183
184
184
// reset component
185
185
$state . reset ( ) ;
@@ -343,40 +343,22 @@ describe('vue-infinite-loading:component', () => {
343
343
vm . $mount ( '#app' ) ;
344
344
} ) ;
345
345
346
- it ( 'should support hide load result through blank slots' , ( done ) => {
347
- let calledTimes = 0 ;
348
-
346
+ it ( 'should remove slot styles if does not configure with `template` tag' , ( done ) => {
349
347
vm = new Vue ( Object . assign ( { } , basicConfig , {
350
348
methods : {
351
349
infiniteHandler : function infiniteHandler ( $state ) {
352
- if ( calledTimes ) {
353
- $state . loaded ( ) ;
354
- $state . complete ( ) ;
355
- this . $nextTick ( ( ) => {
356
- // check for no-more result display
357
- expect ( isShow ( this . $el . querySelectorAll ( '.infinite-status-prompt' ) [ 1 ] ) ) . to . be . false ;
358
- done ( ) ;
359
- } ) ;
360
- } else {
361
- calledTimes += 1 ;
362
- $state . complete ( ) ;
363
- this . $nextTick ( ( ) => {
364
- // check for no-result result display
365
- expect ( isShow ( this . $el . querySelectorAll ( '.infinite-status-prompt' ) [ 0 ] ) ) . to . be . false ;
350
+ // expect empty styles for no results slot
351
+ expect ( this . $el . querySelector ( '.infinite-status-prompt:nth-child(2)' ) . style . color ) . to . be . empty ;
366
352
367
- // reset component to check no- more status
368
- $state . reset ( ) ;
369
- } ) ;
370
- }
353
+ // expect valid styles for no more slot
354
+ expect ( this . $el . querySelector ( '.infinite-status-prompt:nth-child(3)' ) . style . color ) . to . not . be . empty ;
355
+ $state . complete ( ) ;
356
+ done ( ) ;
371
357
} ,
372
358
} ,
373
359
template : `
374
- <infinite-loading
375
- @infinite="infiniteHandler"
376
- ref="infiniteLoading"
377
- >
360
+ <infinite-loading @infinite="infiniteHandler">
378
361
<span slot="no-results"></span>
379
- <span slot="no-more"></span>
380
362
</infinite-loading>
381
363
` ,
382
364
} ) ) ;
0 commit comments