-
Notifications
You must be signed in to change notification settings - Fork 257
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
featureRequest: add isVisible to VueWrapper #628
featureRequest: add isVisible to VueWrapper #628
Conversation
What about the use case of a component with two root nodes?
mount({
template: `<foo v-show="false" />`
}) What does Vue do in this scenario? It looks like we do not have a test for this one. |
@lmiller1990 |
@YutamaKotaro we can still consider this if we have a good solution. What does Vue 3 do? Does it apply |
@lmiller1990 v-show with fragments is very confusing, but I'm getting understanding what I should do thanks to you !!
No. Vue3 doesn't apply that style to any node. describe('child has two nodes', () => {
const Foo = defineComponent({
template: `<div />
<span />`
})
const Root = defineComponent({
template: '<Foo v-show="false" />',
components: {
Foo
}
})
it('mount: returns true', () => {
const wrapper = mount(Root)
expect(wrapper.isVisible()).toBe(true)
})
it('shallowMount: return true', () => {
const wrapper = mount(Root, {
shallow: true
})
expect(wrapper.isVisible()).toBe(true)
})
}) Is my understanding right ?? |
Great, thanks! |
What I want
I'd like to use isVisible in vueWrapper.
I think findComponent and isVisible interfaces are very useful for test, but actually findComponent returns vueWrapper instance which doesn't have isVisible interface.
Hence, below code doesn't work well...
What do you think this featureRequest ....???
I'm sorry if I'm against policy of design, but I guess this specification is more useful than current.