1
- import { describeWithShallowAndMount , vueVersion } from '~resources/utils'
1
+ import { describeWithShallowAndMount , vueVersion , itDoNotRunIf } from '~resources/utils'
2
2
import ComponentWithScopedSlots from '~resources/components/component-with-scoped-slots.vue'
3
3
4
4
describeWithShallowAndMount ( 'scopedSlots' , ( mountingMethod ) => {
5
- if ( vueVersion >= 2.5 ) {
6
- it ( 'mounts component scoped slots' , ( ) => {
5
+ itDoNotRunIf ( vueVersion < 2.5 ,
6
+ 'mounts component scoped slots' , ( ) => {
7
7
const wrapper = mountingMethod ( ComponentWithScopedSlots , {
8
8
scopedSlots : {
9
- 'item' : '<p slot="item" slot -scope="props">{{props.index}},{{props.text}}</p>'
9
+ 'item' : '<p slot-scope="props">{{props.index}},{{props.text}}</p>'
10
10
}
11
11
} )
12
12
expect ( wrapper . html ( ) ) . to . equal ( '<div><p>0,a1</p><p>1,a2</p><p>2,a3</p></div>' )
13
13
wrapper . vm . items = [ { text : 'b1' } , { text : 'b2' } , { text : 'b3' } ]
14
14
expect ( wrapper . html ( ) ) . to . equal ( '<div><p>0,b1</p><p>1,b2</p><p>2,b3</p></div>' )
15
- } )
16
- it ( 'throws exception when it is seted to template tag at top' , ( ) => {
15
+ }
16
+ )
17
+
18
+ itDoNotRunIf ( vueVersion < 2.5 ,
19
+ 'throws exception when it is seted to template tag at top' , ( ) => {
17
20
const fn = ( ) => {
18
21
mountingMethod ( ComponentWithScopedSlots , {
19
22
scopedSlots : {
@@ -23,9 +26,11 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
23
26
}
24
27
const message = '[vue-test-utils]: scopedSlots option does not support template tag.'
25
28
expect ( fn ) . to . throw ( ) . with . property ( 'message' , message )
26
- } )
27
- } else {
28
- it ( 'throws exception when vue version < 2.5' , ( ) => {
29
+ }
30
+ )
31
+
32
+ itDoNotRunIf ( vueVersion >= 2.5 ,
33
+ 'throws exception when vue version < 2.5' , ( ) => {
29
34
const fn = ( ) => {
30
35
mountingMethod ( ComponentWithScopedSlots , {
31
36
scopedSlots : {
@@ -35,6 +40,6 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
35
40
}
36
41
const message = '[vue-test-utils]: scopedSlots option supports [email protected] +.'
37
42
expect ( fn ) . to . throw ( ) . with . property ( 'message' , message )
38
- } )
39
- }
43
+ }
44
+ )
40
45
} )
0 commit comments