Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no unnecessary extend #1084

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
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
28 changes: 10 additions & 18 deletions docs/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,29 +292,21 @@ When `sync` is `false`, the Vue component is rendered asynchronously.

## Other options

When the options for `mount` and `shallowMount` contain the options other than the mounting options, the component options are overwritten with those using [extends](https://vuejs.org/v2/api/#extends).
When the options for `mount` and `shallowMount` contain the options other than the mounting options, the options are added used when the Vue instance is initialized.
Copy link

Choose a reason for hiding this comment

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

When the options for mount and shallowMount contain the options other than the mounting options, the options are added used when the Vue instance is initialized.


```js
const Component = {
template: '<div>{{ foo() }}{{ bar() }}{{ baz() }}</div>',
methods: {
foo () {
return 'a'
},
bar () {
return 'b'
}
}
template: `
Copy link

Choose a reason for hiding this comment

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

This example could be improved to make context more clear.
expect(wrapper.text()).toBe('aBC') would fail?

<div>
id: {$route.params.id}
username: {$store.state.username}
</div>
`
}

const options = {
methods: {
bar () {
return 'B'
},
baz () {
return 'C'
}
}
store,
route
}
const wrapper = mount(Component, options)
expect(wrapper.text()).toBe('aBC')
Expand Down