Skip to content

Commit 8f3239f

Browse files
committed
change test
1 parent ea2d16f commit 8f3239f

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed
Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
import { describeWithShallowAndMount, vueVersion } from '~resources/utils'
1+
import { describeWithShallowAndMount, vueVersion, itDoNotRunIf } from '~resources/utils'
22
import ComponentWithScopedSlots from '~resources/components/component-with-scoped-slots.vue'
33

44
describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
5-
if (vueVersion >= 2.5) {
6-
it('mounts component scoped slots', () => {
5+
itDoNotRunIf(vueVersion < 2.5,
6+
'mounts component scoped slots', () => {
77
const wrapper = mountingMethod(ComponentWithScopedSlots, {
88
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>'
1010
}
1111
})
1212
expect(wrapper.html()).to.equal('<div><p>0,a1</p><p>1,a2</p><p>2,a3</p></div>')
1313
wrapper.vm.items = [{ text: 'b1' }, { text: 'b2' }, { text: 'b3' }]
1414
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', () => {
1720
const fn = () => {
1821
mountingMethod(ComponentWithScopedSlots, {
1922
scopedSlots: {
@@ -23,9 +26,11 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
2326
}
2427
const message = '[vue-test-utils]: scopedSlots option does not support template tag.'
2528
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', () => {
2934
const fn = () => {
3035
mountingMethod(ComponentWithScopedSlots, {
3136
scopedSlots: {
@@ -35,6 +40,6 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
3540
}
3641
const message = '[vue-test-utils]: scopedSlots option supports [email protected]+.'
3742
expect(fn).to.throw().with.property('message', message)
38-
})
39-
}
43+
}
44+
)
4045
})

0 commit comments

Comments
 (0)