-
Notifications
You must be signed in to change notification settings - Fork 663
Closed
Description
Version
1.0.0-beta.29
Reproduction link
https://github.com/anthonygore/vuetify-test
Steps to reproduce
npm i
npm run test:unit
What is expected?
All tests should pass
What is actually happening?
The second test fails as the VTextField component can't be found.
I don't know if this is a Vuetify issue or a Vue Test Utils issue, but some stubbed child components can't be found with the find wrapper method when the parent is shallow mounted.
It's not just VTextField, either, VSelect also has this problem, while others like VIcon work just fine.
import { shallowMount } from "@vue/test-utils";
import Vuetify from "vuetify";
import { VBtn, VTextField } from "vuetify/lib";
Vue.use(Vuetify);
const component = {
template: `
<div>
<v-btn />
<v-text-field />
</div>
`
};
// Passes
it('should find v-btn', () => {
const wrapper = shallowMount(component);
expect(wrapper.find(VBtn).exists()).toBe(true);
});
// Fails
it('should find v-text-field', () => {
const wrapper = shallowMount(component);
expect(wrapper.find(VTextField).exists()).toBe(true);
});Update
I think the issue is something to do with how some global components are registered because this works:
Vue.use(Vuetify);
const component = {
template: `
<div>
<v-btn />
<v-text-field />
</div>
`,
components: {
VTextField
}
};Note that I don't need to locally register VBtn, just VTextField...
Djaler, jasonandmonte and Belzee10
Metadata
Metadata
Assignees
Labels
No labels