Skip to content

Hotfix: Fix clone issue with vue.extend components #115

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

Merged
merged 1 commit into from
Oct 20, 2017

Conversation

blake-newman
Copy link
Member

@blake-newman blake-newman commented Oct 20, 2017

  • Moving the previous extend fix logic out to mount and shallow
    hooks fixes cloning of component

issue

import { mount } from 'vue-test-utils'
import ContainerTest from 'container/Test.vue'

const options = {
  mocks: { $route: 'test' }
}

const wrapper = mount(ContainerTest, options)
console.log(wrapper.vm.$route) // test

const wrapper2 = mount(ContainerTest)
console.log(wrapper2.vm.$route) // test

Fix

import { mount } from 'vue-test-utils'
import ContainerTest from 'container/Test.vue'

const options = {
  mocks: { $route: 'test' }
}

const wrapper = mount(ContainerTest, options)
console.log(wrapper.vm.$route) // test

const wrapper2 = mount(ContainerTest)
console.log(wrapper2.vm.$route) // undefined

- Moving the previous extend fix logic out to `mount` and `shallow`
hooks fixes cloning of component

```js
import { mount } from 'vue-test-utils'
import ContainerTest from 'container/Test.vue'

const options = {
  mocks: { $route: 'test' }
}

const wrapper = mount(ContainerTest, options)
console.log(wrapper.vm.$route) // test

const wrapper2 = mount(ContainerTest)
console.log(wrapper2.vm.$route) // test
```

```js
import { mount } from 'vue-test-utils'
import ContainerTest from 'container/Test.vue'

const options = {
  mocks: { $route: 'test' }
}

const wrapper = mount(ContainerTest, options)
console.log(wrapper.vm.$route) // test

const wrapper2 = mount(ContainerTest)
console.log(wrapper2.vm.$route) // undefined
```
@eddyerburgh eddyerburgh merged commit a5c0e04 into dev Oct 20, 2017
@blake-newman blake-newman deleted the hotfix/fix-extend-clone-issue branch October 23, 2017 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants