File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import Hello from './components/Hello.vue'
4
4
import ComponentWithoutName from './components/ComponentWithoutName.vue'
5
5
6
6
const compC = defineComponent ( {
7
- // name: 'ComponentC',
7
+ name : 'ComponentC' ,
8
8
template : '<div class="C">C</div>'
9
9
} )
10
10
@@ -83,9 +83,21 @@ describe('findComponent', () => {
83
83
expect ( wrapper . findComponent ( { name : 'component-c' } ) . exists ( ) ) . toBeTruthy ( )
84
84
} )
85
85
86
- it ( 'finds root component' , ( ) => {
87
- const wrapper = mount ( compA )
88
- expect ( wrapper . findComponent ( compA ) . exists ( ) ) . toBe ( true )
86
+ it ( 'finds root component' , async ( ) => {
87
+ const Comp = defineComponent ( {
88
+ name : 'C' ,
89
+ template : `
90
+ <input v-model="msg" />
91
+ {{ msg }}
92
+ ` ,
93
+ data ( ) {
94
+ return { msg : 'foo' }
95
+ }
96
+ } )
97
+ const wrapper = mount ( Comp )
98
+ expect ( wrapper . findComponent ( Comp ) . exists ( ) ) . toBe ( true )
99
+ await wrapper . find ( 'input' ) . setValue ( 'bar' )
100
+ expect ( wrapper . html ( ) ) . toContain ( 'bar' )
89
101
} )
90
102
91
103
it ( 'finds component without a name by using its object definition' , ( ) => {
You can’t perform that action at this time.
0 commit comments