I'm test a custom component with vue test utils and Jest. My component uses Vuetify component, and so I need to declare a div with data-app attribute, in order to have the menu rendered (if I dont, I get the following error :
wrapper = mount(MyComponent, {
propsData: {
value: 1
}});
[Vuetify] Unable to locate target [data-app]
If my component didn't use any properties, I would do like this:
wrapper = mount(Vue.extend({
template: `<div data-app="true"><MyComponent /></div>`,
}), {
attachToDocument: true
});
But, then, I can't set component properties, can I?
So I thought about using parentComponent property like this:
const parent = {
template: `<div data-app="true"><MyComponent /></div>`,
};
wrapper = mount(MyComponent, {
parentComponent: parent,
propsData: {
value: 1'
}});
But it does not work either.
Is there any way to test my component?