Skip to content

Commit f592acc

Browse files
sagalboteddyerburgh
authored andcommitted
docs: add propsData to Mounting Options (#926)
1 parent 6fbdea0 commit f592acc

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

docs/api/options.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ Options for `mount` and `shallowMount`. The options object can contain both Vue
99
- [`mocks`](#mocks)
1010
- [`localVue`](#localvue)
1111
- [`attachToDocument`](#attachtodocument)
12+
- [`propsData`](#propsdata)
1213
- [`attrs`](#attrs)
1314
- [`listeners`](#listeners)
14-
- [`parentComponent`](#parentComponent)
15+
- [`parentComponent`](#parentcomponent)
1516
- [`provide`](#provide)
1617
- [`sync`](#sync)
1718

1819
## context
1920

2021
- type: `Object`
2122

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).
2324

2425
Example:
2526

@@ -206,6 +207,32 @@ Component will be attached to DOM when rendered if set to `true`.
206207

207208
Set the component instance's `$attrs` object.
208209

210+
## propsData
211+
212+
- type: `Object`
213+
214+
Set the component instance's props.
215+
216+
Example:
217+
218+
```js
219+
const Component = {
220+
template: '<div>{{ msg }}</div>',
221+
props: ['msg']
222+
}
223+
const wrapper = 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).
234+
:::
235+
209236
## listeners
210237

211238
- type: `Object`

0 commit comments

Comments
 (0)