-
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
v-if inside transition element not re rendering in beta30 #1384
Comments
A lot of things broke relating to transitions in beta 30. There is a work around that might help documented here: https://vue-test-utils.vuejs.org/guides/#common-tips (under "Mocking transitions") however this is a bug we will fix before v1.0 I will try to look into this one in the new year. |
Thanks, workaround worked. Didnt saw this section of guide, since it was added only in v30 :) |
why close since its valid issue that is supposed to be fixed before v1 ? Is there other issue that could be tracked to see when its solved? |
Whoops! I misread this. My apologies. Thank you for pinging on the issue |
I don't believe this is isolated to just the transition element. I'm seeing the same issue with Re-writing the tests to not use Begs the question: does Example.vue:
Spec:
It passes just fine with |
You need to "await " that tick. |
I thought the same thing; however:
|
It's also passing in |
I think I see what's going on here. The removal of the synchronous mode in That still doesn't explain why it's breaking with async/await when |
I just tried the code you provided with beta-30 with async/await and it worked fine for me: <template>
<div>
<p v-if="show">Foo</p>
</div>
</template>
<script>
export default {
data() {
return {
show: true
}
}
}
</script> import { mount } from '@vue/test-utils';
import Example from '@/components/HelloWorld.vue';
test("should render Foo, then hide it", async () => {
const wrapper = mount(Example)
expect(wrapper.text()).toMatch(/Foo/)
wrapper.setData({
show: false
})
await wrapper.vm.$nextTick()
expect(wrapper.text()).not.toMatch(/Foo/)
}) |
As expected, stubbing the transition lets this pass: stubs: {
'VScrollXTransition': true
} I think we should automatically stub all transitions in VTU. They are used for animations and that sort of thing, nothing you would actually want to need to test in a unit test. Users could opt out with: stubs: {
transition: false, // or
'VScrollXTransition': false // or something like this
} It looks like Vuetify just wraps Vue's I'll see what the rest of the teams thinks, and go for that unless someone has something better. I think fixing the transition bugs will close off a few other issues that are open, too. |
Version
1.0.0-beta.30
Reproduction link
https://github.com/aldarund/vue-test-utils-transition-bug
Steps to reproduce
components/test.test.js
When changing rendering v-if of element inside transition and do nextTick/flushPromises vue test utils still renders old version.
Tried with flush-promises too, same effect.
Relevant files only following
components\TransitionTest.vue
components\test.test.js
all other just stub files from empty project create.
What is expected?
test is passed
What is actually happening?
test is failing
If change version to v29 all works fine. Without wrapping into transition all works too
The text was updated successfully, but these errors were encountered: