-
Notifications
You must be signed in to change notification settings - Fork 669
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
Event are not retrieved by emitted() when using Collapse from BootstrapVue #758
Comments
Thanks for the detailed bug report, and sorry for the issues this has caused you. Yes this is a bug with Vue Test Utils, and is part of a wider bug we have with asynchrnous DOM updates. A temporary workaround if to run your tests asynchronously, without a transition stub: let wrapper = mount(App, {
sync: false,
stubs: {
'transition': false
}
}); You'll need to edit your assertion to run in a timeout calback: test('some test', (done) => {
// ..
setTimeout(() => {
expect(wrapper.emitted().MyCompExpand).toBeTruthy();
done()
})
}) |
|
In order to keep the issue tracker clean, I'm closing the original sync issue in favor of #676. I'm working to find a solution to this bug, but it will be easier for me to manage other issues if there is only one open issue to track. |
Version
1.0.0-beta.16
Reproduction link
https://github.com/klak-bm/bv-collapse-problem/
Steps to reproduce
git clone https://github.com/klak-bm/bv-collapse-problem/ && cd bv-collapse-problem/ && npm i && npm test
What is expected?
First test should return emitted events but it does not.
What is actually happening?
0 event returned
I already tried in local with beta.20 but doesnt change anything.
The working test shows that instead of clicking on the button which triggers the "expand", if I force emitting the corresponding event the test is working (I expect another event to be emitted then).
At first, I thought the problem was coming from bootstrap-vue (and their collapse transition) but after discussing with their active members, they took a look and finally told me :
"The show should be emitted regardless of transition
The HTML already has the correct aria expanded and show class
Which makes me think, perhaps the test wrapper on the child component (b-collapse) isn't firing it's event on the test"
"This sounds like a potential Vue test utils bug to be honest"
The text was updated successfully, but these errors were encountered: