You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/options.md
+29-2Lines changed: 29 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,17 +9,18 @@ Options for `mount` and `shallowMount`. The options object can contain both Vue
9
9
-[`mocks`](#mocks)
10
10
-[`localVue`](#localvue)
11
11
-[`attachToDocument`](#attachtodocument)
12
+
-[`propsData`](#propsdata)
12
13
-[`attrs`](#attrs)
13
14
-[`listeners`](#listeners)
14
-
-[`parentComponent`](#parentComponent)
15
+
-[`parentComponent`](#parentcomponent)
15
16
-[`provide`](#provide)
16
17
-[`sync`](#sync)
17
18
18
19
## context
19
20
20
21
- type: `Object`
21
22
22
-
Passes context to functional component. Can only be used with functional components.
23
+
Passes context to functional component. Can only be used with [functional components](https://vuejs.org/v2/guide/render-function.html#Functional-Components).
23
24
24
25
Example:
25
26
@@ -206,6 +207,32 @@ Component will be attached to DOM when rendered if set to `true`.
206
207
207
208
Set the component instance's `$attrs` object.
208
209
210
+
## propsData
211
+
212
+
- type: `Object`
213
+
214
+
Set the component instance's props.
215
+
216
+
Example:
217
+
218
+
```js
219
+
constComponent= {
220
+
template:'<div>{{ msg }}</div>',
221
+
props: ['msg']
222
+
}
223
+
constwrapper=mount(Component, {
224
+
propsData: {
225
+
msg:'aBC'
226
+
}
227
+
})
228
+
expect(wrapper.text()).toBe('aBC')
229
+
```
230
+
231
+
::: tip
232
+
It's worth noting that `propsData` is actually a [Vue API](https://vuejs.org/v2/api/#propsData), not a
233
+
`vue-test-utils` option. It is processed through [`extends`](#other-options).
0 commit comments