@@ -21,7 +21,7 @@ describe('InfiniteLoading.vue', () => {
21
21
isCustomSpinner : false ,
22
22
listContainerHeight : 100 ,
23
23
listItemHeight : 10 ,
24
- customSpinnerHeight : 10
24
+ customSpinnerHeight : 10 ,
25
25
} ,
26
26
template : `
27
27
<div style="margin: 0; padding: 0;"
@@ -30,16 +30,21 @@ describe('InfiniteLoading.vue', () => {
30
30
height: listContainerHeight + 'px'
31
31
}">
32
32
<ul style="margin: 0; padding: 0; font-size: 5px;">
33
- <li v-for="item in list" v-text="item" style="height: 10px; margin: 0; padding: 0;" :style="{
34
- height: listItemHeight + 'px'
33
+ <li v-for="item in list" v-text="item"
34
+ style="height: 10px; margin: 0; padding: 0;"
35
+ :style="{
36
+ height: listItemHeight + 'px'
35
37
}"></li>
36
38
</ul>
37
39
<infinite-loading :distance="distance"
38
40
:on-infinite="onInfinite"
39
41
v-if="!isLoadedAll">
40
- <span slot="spinner" v-if="isCustomSpinner"><i class="custom-spinner" style="display: inline-block; width: 10px;" :style="{
41
- height: customSpinnerHeight + 'px'
42
- }"></i></span>
42
+ <span slot="spinner" v-if="isCustomSpinner">
43
+ <i class="custom-spinner" style="display: inline-block; width: 10px;"
44
+ :style="{
45
+ height: customSpinnerHeight + 'px'
46
+ }"></i>
47
+ </span>
43
48
</infinite-loading>
44
49
</div>
45
50
` ,
@@ -140,24 +145,25 @@ describe('InfiniteLoading.vue', () => {
140
145
vm . $mount ( ) . $appendTo ( 'body' ) ;
141
146
} ) ;
142
147
143
- it ( 'should load results to fill up the container' , function ( done ) {
148
+ it ( 'should load results to fill up the container' , function fillUpTest ( done ) {
144
149
const TEST_TIMEOUT = 2000 ;
145
- let mocha = this ;
150
+ const mocha = this ;
146
151
let i = 0 ;
147
152
vm . listContainerHeight = 100 ;
148
153
vm . listItemHeight = 10 ;
149
154
vm . distance = 10 ;
150
155
vm . isCustomSpinner = true ;
151
156
vm . customSpinnerHeight = 10 ;
152
- let expectedCount = Math . floor ( vm . listContainerHeight / vm . listItemHeight ) ;
157
+ const expectedCount = Math . floor ( vm . listContainerHeight / vm . listItemHeight ) ;
158
+
153
159
vm . onInfinite = function test ( ) {
154
160
this . list . push ( ++ i ) ;
155
161
Vue . nextTick ( ( ) => {
156
162
this . $broadcast ( '$InfiniteLoading:loaded' ) ;
157
- if ( i == expectedCount ) {
163
+ if ( i === expectedCount ) {
158
164
mocha . timeout ( TEST_TIMEOUT + 100 ) ;
159
- setTimeout ( function ( ) {
160
- if ( i == expectedCount ) {
165
+ setTimeout ( ( ) => {
166
+ if ( i === expectedCount ) {
161
167
done ( ) ;
162
168
} else {
163
169
done ( new Error ( 'Unexpected number of items added' ) ) ;
0 commit comments