-
Notifications
You must be signed in to change notification settings - Fork 665
Wrapper do not render v-dialog (Vuetify) #1333
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
Comments
Is the v-dialog in a named slot? |
Closing this because of inactivity. Comment if you still have issues. |
I'm running into the exact same issue |
@Stoom + @dobromir-hristov |
+1 |
It could be how v-dialog is attached to the dom. If I remember correctly it's attached towards the root, outside of your component. Maybe try adding a test ID? I don't remember how I got to it of the top of my head 😔 |
i initialize component with param attachTo, but it didn’t give the desired result: const div = document.createElement('div');
div.setAttribute('data-app', true);
document.body.appendChild(div);
wrapper = mount(ContactListChange, {
attachTo: document.body
}); |
Also not working for me. I've added the |
Facing the same issue. Any solution to this ? |
+1 |
+1, can't test my component containing v-dialog |
+1 wrapper.html() produces below result:
couldn't seem to find v-dialog in wrapper |
If you're looking for a work around something like this seems to have gotten me over the hurdle const WrapperComponent = defineComponent({
props: { props: Object as PropType<AComponentProps> },
template: `
<v-defaults-provider :defaults="{'VDialog':{'contained':true }}">
<component-containing-dialog v-bind="props"/>
</v-defaults-provider>
`,
});
function createComponentWrapper(props: AComponentProps) {
return mount(WrapperComponent, {
global: {
plugins: [createVuetify({components, directives})],
components: {
'component-containing-dialog': AComponent
}
},
props: {props},
});
}
test('Doesnt explode', () => {
const wrapper = createComponentWrapper({});
expect(wrapper.exists()).toBeTruthy();
console.log(wrapper.html());
}); |
Version
1.0.0-beta.29
Reproduction link
https://forum.vuejs.org/t/how-to-test-ux-of-v-dialog-vuetify-components-which-is-not-appears-in-wrapper/78114
Steps to reproduce
Already two weeks I'll try to solve a little problem with vue-test-utils and testing of v-dialog component.
Aim: To test proper behaviour of UI.
Chain of Components: CreateProposal -> CreateEditProposal -> List of form fields components.
My test is:
I expect that after clicking a "Open Address Book" button I can check if modal window appears.
But in fact, I can't do that because mount method does not render it.
After a days of research, I found a way to render v-dialog modal html code using render() method from '@vue/server-test-utils'.
The result HTML contains all I want.
But this wrapper is not a VUE instance. So I cant interact with it with vue-test-utils.
So. Question is:
How to test UI and UX with vue-test-utils and especially with vuetify v-dialog component.
Thanks for any help!
What is expected?
html of v-dialog component
What is actually happening?
nothing
The text was updated successfully, but these errors were encountered: