[Vuejs]-How to verify modal window is displayed or not

0👍

I think in your test, you encounter an update applied by Vue, which is asynchronous behavior.
So after changing the reactive property (enable = false), you should wait for Vue to update DOM by adding this line:

await Vue.nextTick();
expect(wrapper.findComponent('.v-picker').exists()).toBe(false);

0👍

Vuetify renders its dialogs, menus, pickers (etc.) outside of the application wrapper, that’s why wrapper.html() doesn’t help you.

I believe the correct way is to use attachTo option, so you can mount your component inside the div with the data-app attribute.

If that doesn’t work for you, you can also set data-app attribute on body:

let node = document.createElement('body');
node.setAttribute("data-app", true);

Leave a comment