Skip to content

Commit 0a46a2f

Browse files
committed
git st
1 parent d645037 commit 0a46a2f

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

test/unit/specs/mount.spec.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import ComponentWithProps from '~resources/components/component-with-props.vue'
55
import ComponentWithMixin from '~resources/components/component-with-mixin.vue'
66
import createLocalVue from '~src/create-local-vue'
77

8+
function injectSupported () {
9+
console.log(Vue.version)
10+
const version = Number(`${Vue.version.split('.')[0]}.${Vue.version.split('.')[1]}`)
11+
console.log(version)
12+
return version > 2.2
13+
}
14+
815
describe('mount', () => {
916
it('returns new VueWrapper with mounted Vue instance if no options are passed', () => {
1017
const compiled = compileToFunctions('<div><input /></div>')
@@ -89,7 +96,7 @@ describe('mount', () => {
8996

9097
it('deletes mounting options before passing options to component', () => {
9198
const wrapper = mount({
92-
template: `<div>foo</div>`
99+
render: h => h('div')
93100
}, {
94101
provide: {
95102
'prop': 'val'
@@ -114,9 +121,16 @@ describe('mount', () => {
114121
'prop': 'val'
115122
}
116123
})
117-
debugger
118-
// provide is always a function on an the $options object
119-
expect(typeof wrapper.vm.$options.provide).to.equal('function')
124+
const version = Number(`${Vue.version.split('.')[0]}.${Vue.version.split('.')[1]}`)
125+
if (injectSupported()) {
126+
// provide is added by Vue, it's a function in Vue > 2.3
127+
if (version > 2.3) {
128+
expect(typeof wrapper.vm.$options.provide).to.equal('function')
129+
} else {
130+
expect(typeof wrapper.vm.$options.provide).to.equal('object')
131+
}
132+
}
133+
120134
expect(wrapper.vm.$options.custom).to.equal(undefined)
121135
expect(wrapper.vm.$options.attachToDocument).to.equal(undefined)
122136
expect(wrapper.vm.$options.mocks).to.equal(undefined)

0 commit comments

Comments
 (0)