File tree 2 files changed +25
-2
lines changed
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ export class VueWrapper implements WrapperAPI {
19
19
) {
20
20
this . __vm = vm
21
21
this . __setProps = setProps
22
- this . componentVM = this . vm . $refs [ 'VTU_COMPONENT' ] as ComponentPublicInstance
22
+ this . componentVM = this . __vm . $refs [
23
+ 'VTU_COMPONENT'
24
+ ] as ComponentPublicInstance
23
25
this . __emitted = events
24
26
}
25
27
@@ -42,7 +44,7 @@ export class VueWrapper implements WrapperAPI {
42
44
}
43
45
44
46
get vm ( ) : ComponentPublicInstance {
45
- return this . __vm
47
+ return this . componentVM
46
48
}
47
49
48
50
classes ( className ?: string ) {
Original file line number Diff line number Diff line change
1
+ import { defineComponent , ref } from 'vue'
2
+
3
+ import { mount } from '../src'
4
+
5
+ describe ( 'vm' , ( ) => {
6
+ it ( 'returns the component vm' , ( ) => {
7
+ const Component = defineComponent ( {
8
+ template : '<div>{{ msg }}</div>' ,
9
+ setup ( ) {
10
+ const msg = 'hello'
11
+ const isEnabled = ref ( true )
12
+ return { msg, isEnabled }
13
+ }
14
+ } )
15
+
16
+ const wrapper = mount ( Component )
17
+
18
+ expect ( ( wrapper . vm as any ) . msg ) . toBe ( 'hello' )
19
+ expect ( ( wrapper . vm as any ) . isEnabled ) . toBe ( true )
20
+ } )
21
+ } )
You can’t perform that action at this time.
0 commit comments