Open
Description
Will probably rely on #9
Instead of shallowMount
, I think we should have a shallow
mounting option (discussed internally).
const Comp = mount({
shallow: true
})
How this should work
shallowMount
was pretty buggy in VTU beta. It should completely stub out and child components. So:
<template>
<div>Content</div>
<Foo />
<Bar>
<div>BAR</div>
</Bar>
</template>
Should render as follows when using shallow
:
<div>Content</div>
<foo-stub />
<bar-stub />
Whether it's <FooStub />
or <foo-stub>
/> doesn't matter, the point is that the components are no longer rendered, nor is any of their code executed.
Things to consider:
- should a user be able to
find
a stubbed out component? Feels a bit weird to try and find a component that is purposefully NOT rendered. But it might be a common use case - current
find
does not supportfind(Component)
syntax. I'm not sure it should - it was impossiblefind
. One such issue: Some stubbed Vuetify components can't be found withfind
wrapper method vuejs/vue-test-utils#1272 and - consider this use case Can't trigger event of child component vuejs/vue-test-utils#1410 people often stub out components then want to emit an event from them. Can we handle this better?
Metadata
Metadata
Assignees
Labels
No labels