@@ -2,7 +2,7 @@ import { mount, shallowMount } from '../src'
2
2
import WithProps from './components/WithProps.vue'
3
3
import PropWithSymbol from './components/PropWithSymbol.vue'
4
4
import Hello from './components/Hello.vue'
5
- import { defineComponent , h } from 'vue'
5
+ import { defineComponent , h , isRef , ref } from 'vue'
6
6
import Title from './components/FunctionComponent'
7
7
8
8
describe ( 'props' , ( ) => {
@@ -157,6 +157,31 @@ describe('props', () => {
157
157
expect ( wrapper . find ( '#foo2' ) . attributes ( ) . foo ) . toBe ( 'foo2 value' )
158
158
} )
159
159
160
+ it ( 'should forward ref as raw prop' , ( ) => {
161
+ const TestComponent = defineComponent ( {
162
+ props : {
163
+ refProp : {
164
+ type : [ Object ] ,
165
+ required : true
166
+ }
167
+ } ,
168
+ setup ( props ) {
169
+ return ( ) =>
170
+ h ( 'div' , [
171
+ h ( 'h1' , isRef ( props . refProp ) ? 'is ref' : 'is not ref' ) ,
172
+ h ( 'span' , props . refProp . value )
173
+ ] )
174
+ }
175
+ } )
176
+
177
+ const refProp = ref ( 'Some value' )
178
+ const wrapper = mount ( TestComponent , {
179
+ props : { refProp }
180
+ } )
181
+ expect ( wrapper . find ( 'h1' ) . text ( ) ) . toBe ( 'is ref' )
182
+ expect ( wrapper . find ( 'span' ) . text ( ) ) . toBe ( 'Some value' )
183
+ } )
184
+
160
185
it ( 'returns reactive props on a stubbed component shallow case' , async ( ) => {
161
186
const Foo = {
162
187
name : 'Foo' ,
0 commit comments