1.0.0-beta.25
https://github.com/EIREXE/buefy-bug
That the test works without any extra error
The test errors out (and events such as @click don't work)
``` console.error node_modules/vue/dist/vue.runtime.common.js:589
[Vue warn]: Error in created hook: "Error: You should wrap bDropdownItem on a bDropdown"
found in
---> <BDropdownItem>
<BDropdown>
<PostItem>
<Root>
console.error node_modules/vue/dist/vue.runtime.common.js:1739
Error: You should wrap bDropdownItem on a bDropdown
at VueComponent.created (/home/tarda/figuresite/frontend/node_modules/buefy/dist/buefy.js:5471:19)
```
This is a vue-test-utils exclusive error, so I believe buefy is not to blame here.
Forgot to add the particular error, it's done now...
The issue is caused by Vue Test Utils stubbing the Transition component. For now, you can fix the error by telling Vue Test Utils not to stub Transition:
const msg = 'new message'
const wrapper = mount(HelloWorld, {
propsData: { msg },
stubs: {
transition: false
}
})
expect(wrapper.find({ ref: 'a1b' }))
Unfortunately this means you will sometimes need to use Vue.nextTick to wait for the Transition component to re render:
it('renders props.msg when passed', (done) => {
const wrapper = mount(HelloWorld, {
stubs: {
transition: false
}
})
expect(wrapper.find({ ref: 'a1b' }))
wrapper.trigger('click')
Vue.nextTick(() => {
assert(wrapper.text()).toBe('some text')
done()
})
})
This bug with the Transition stub will probably be fixed in the future after Vue 2.5.18 is released, by removing the Transition stub when Vue is running in sync mode.
Alternatively we could fix the TransitionStub component stub to stop the error.
That appears to fix it, thank you for providing a workaround in the meantime!
This is the same issue reported in #958, so I'll close this in favor of that issue.
Most helpful comment
The issue is caused by Vue Test Utils stubbing the Transition component. For now, you can fix the error by telling Vue Test Utils not to stub Transition:
Unfortunately this means you will sometimes need to use
Vue.nextTickto wait for the Transition component to re render:This bug with the Transition stub will probably be fixed in the future after Vue 2.5.18 is released, by removing the Transition stub when Vue is running in sync mode.
Alternatively we could fix the TransitionStub component stub to stop the error.