Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions docs/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ Options for `mount` and `shallowMount`. The options object can contain both Vue
- [`mocks`](#mocks)
- [`localVue`](#localvue)
- [`attachToDocument`](#attachtodocument)
- [`propsData`](#propsdata)
- [`attrs`](#attrs)
- [`listeners`](#listeners)
- [`parentComponent`](#parentComponent)
- [`parentComponent`](#parentcomponent)
- [`provide`](#provide)
- [`sync`](#sync)

## context

- type: `Object`

Passes context to functional component. Can only be used with functional components.
Passes context to functional component. Can only be used with [functional components](https://vuejs.org/v2/guide/render-function.html#Functional-Components).

Example:

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

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

## propsData

- type: `Object`

Set the component instance's props.

Example:

```js
const Component = {
template: '<div>{{ msg }}</div>',
props: ['msg']
}
const wrapper = mount(Component, {
propsData: {
msg: 'aBC'
}
})
expect(wrapper.text()).toBe('aBC')
```

::: tip
It's worth noting that `propsData` is actually a [Vue API](https://vuejs.org/v2/api/#propsData), not a proprietary
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great explanation, although can you remove the word proprietary, it sounds too formal. So:

It's worth noting that propsDatais actually a [Vue API](https://vuejs.org/v2/api/#propsData), not avue-test-utils option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger that, done.

`vue-test-utils` option. It is processed through [`extends`](#other-options).
:::

## listeners

- type: `Object`
Expand Down