File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 9
9
ComponentOptionsWithArrayProps ,
10
10
ComponentOptionsWithoutProps ,
11
11
ExtractPropTypes ,
12
- WritableComputedOptions ,
13
12
AppConfig ,
14
13
VNodeProps ,
15
14
ComponentOptionsMixin ,
@@ -38,7 +37,10 @@ import { createWrapper, VueWrapper } from './vueWrapper'
38
37
import { attachEmitListener } from './emit'
39
38
import { createDataMixin } from './dataMixin'
40
39
import { createStub , stubComponents , addToDoNotStubComponents } from './stubs'
41
- import { isLegacyFunctionalComponent } from './utils/vueCompatSupport'
40
+ import {
41
+ isLegacyFunctionalComponent ,
42
+ unwrapLegacyVueExtendComponent
43
+ } from './utils/vueCompatSupport'
42
44
43
45
// NOTE this should come from `vue`
44
46
type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps
@@ -218,10 +220,11 @@ export function mount<
218
220
219
221
// implementation
220
222
export function mount (
221
- originalComponent : any ,
223
+ inputComponent : any ,
222
224
options ?: MountingOptions < any >
223
225
) : VueWrapper < any > {
224
226
// normalise the incoming component
227
+ let originalComponent = unwrapLegacyVueExtendComponent ( inputComponent )
225
228
let component : ConcreteComponent
226
229
227
230
if (
Original file line number Diff line number Diff line change @@ -130,4 +130,17 @@ describe('@vue/compat build', () => {
130
130
131
131
expect ( wrapper . html ( ) ) . toBe ( '<div>stubbed</div>' )
132
132
} )
133
+
134
+ it ( 'wrapper.vm points to correct instance when component is wrapped with Vue.extend' , ( ) => {
135
+ const Component = extend ( {
136
+ data ( ) {
137
+ return { foo : 'bar' }
138
+ } ,
139
+ template : '<div></div>'
140
+ } )
141
+
142
+ const wrapper = mount ( Component )
143
+
144
+ expect ( wrapper . vm . foo ) . toBe ( 'bar' )
145
+ } )
133
146
} )
You can’t perform that action at this time.
0 commit comments