1
- import Vue from 'vue' ;
1
+ import Vue from 'vue/dist/vue.common.js ' ;
2
2
import InfiniteLoading from '../../../src/components/InfiniteLoading' ;
3
3
4
4
function isShow ( elm ) {
@@ -22,52 +22,31 @@ describe('InfiniteLoading.vue', () => {
22
22
direction : 'bottom' ,
23
23
} ;
24
24
} ,
25
- render ( createElement ) {
26
- return createElement (
27
- 'div' ,
28
- {
29
- style : {
30
- height : `${ this . listContainerHeight } px` ,
31
- overflow : this . isDivScroll ? 'auto' : 'visible' ,
32
- } ,
33
- } ,
34
- [
35
- createElement ( 'ul' , {
36
- style : {
37
- margin : 0 ,
38
- padding : 0 ,
39
- } ,
40
- } , this . list . map ( ( item ) => createElement ( 'li' , {
41
- style : {
42
- height : `${ this . listItemHeight } px` ,
43
- } ,
44
- } , item ) ) ) ,
45
- this . isLoadedAll ? undefined : createElement ( InfiniteLoading ,
46
- {
47
- props : {
48
- distance : this . distance ,
49
- onInfinite : this . onInfinite ,
50
- direction : this . direction ,
51
- } ,
52
- ref : 'infiniteLoading' ,
53
- } ,
54
- [
55
- this . isCustomSpinner ? createElement ( 'span' ,
56
- {
57
- slot : 'spinner' ,
58
- } ,
59
- [
60
- createElement ( 'i' , {
61
- attrs : {
62
- class : 'custom-spinner' ,
63
- } ,
64
- } ) ,
65
- ]
66
- ) : undefined ,
67
- ]
68
- ) ,
69
- ]
70
- ) ;
25
+ template : `
26
+ <div style="margin: 0; padding: 0;"
27
+ :style="{
28
+ overflow: isDivScroll ? 'auto' : 'visible',
29
+ height: listContainerHeight + 'px'
30
+ }">
31
+ <ul style="margin: 0; padding: 0;">
32
+ <li v-for="item in list" v-text="item"
33
+ :style="{ height: listItemHeight + 'px' }">
34
+ </li>
35
+ </ul>
36
+ <infinite-loading :distance="distance"
37
+ :direction="direction"
38
+ :on-infinite="onInfinite"
39
+ v-if="!isLoadedAll"
40
+ ref="infiniteLoading">
41
+ <span slot="spinner" v-if="isCustomSpinner">
42
+ <i class="custom-spinner"></i>
43
+ </span>
44
+ </infinite-loading>
45
+ </div>
46
+ ` ,
47
+ components : { InfiniteLoading } ,
48
+ methods : {
49
+ onInfinite ( ) { } ,
71
50
} ,
72
51
} ;
73
52
@@ -214,7 +193,7 @@ describe('InfiniteLoading.vue', () => {
214
193
215
194
it ( 'should display the custom spinner if customize it with slot' , ( done ) => {
216
195
vm . isCustomSpinner = true ;
217
- delete vm . distance ;
196
+ vm . distance = 100 ;
218
197
vm . $mount ( '#app' ) ;
219
198
220
199
Vue . nextTick ( ( ) => {
0 commit comments