@@ -5,6 +5,13 @@ import ComponentWithProps from '~resources/components/component-with-props.vue'
5
5
import ComponentWithMixin from '~resources/components/component-with-mixin.vue'
6
6
import createLocalVue from '~src/create-local-vue'
7
7
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
+
8
15
describe ( 'mount' , ( ) => {
9
16
it ( 'returns new VueWrapper with mounted Vue instance if no options are passed' , ( ) => {
10
17
const compiled = compileToFunctions ( '<div><input /></div>' )
@@ -89,7 +96,7 @@ describe('mount', () => {
89
96
90
97
it ( 'deletes mounting options before passing options to component' , ( ) => {
91
98
const wrapper = mount ( {
92
- template : `<div>foo</ div>`
99
+ render : h => h ( ' div' )
93
100
} , {
94
101
provide : {
95
102
'prop' : 'val'
@@ -114,9 +121,16 @@ describe('mount', () => {
114
121
'prop' : 'val'
115
122
}
116
123
} )
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
+
120
134
expect ( wrapper . vm . $options . custom ) . to . equal ( undefined )
121
135
expect ( wrapper . vm . $options . attachToDocument ) . to . equal ( undefined )
122
136
expect ( wrapper . vm . $options . mocks ) . to . equal ( undefined )
0 commit comments