You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone,
I am experiencing an issue when adding unit tests to my Vue 3 application that uses Vuetify. I am following the guide provided on the Vuetify Unit Testing Guide page. While tests work fine for basic components, I encounter a problem when trying to test layout components such as v-app-bar. The wrapper is unexpectedly empty and does not contain any child components.
Expected Behavior:
The wrapper should include all child components of v-app-bar so that they can be tested.
Actual Behavior:
The wrapper is empty and does not contain any child components, making it impossible to test.
Code:
// BaseTest.spec.jsimport{mount}from'@vue/test-utils'import{expect,test}from'vitest'import{createVuetify}from'vuetify'import*ascomponentsfrom'vuetify/components'import*asdirectivesfrom'vuetify/directives'constvuetify=createVuetify({
components,
directives,})global.ResizeObserver=require('resize-observer-polyfill')test('displays message',()=>{constwrapper=mount({template: ` <v-app> <v-app-bar> <v-toolbar-title>My App</v-toolbar-title> </v-app-bar> </v-app>`},{props: {},global: {plugins: [vuetify],}})console.log(wrapper.html());// Assert the rendered text of the componentexpect(wrapper.text()).toContain('My App')})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
I am experiencing an issue when adding unit tests to my Vue 3 application that uses Vuetify. I am following the guide provided on the Vuetify Unit Testing Guide page. While tests work fine for basic components, I encounter a problem when trying to test layout components such as
v-app-bar
. The wrapper is unexpectedly empty and does not contain any child components.Expected Behavior:
The wrapper should include all child components of
v-app-bar
so that they can be tested.Actual Behavior:
The wrapper is empty and does not contain any child components, making it impossible to test.
Code:
Beta Was this translation helpful? Give feedback.
All reactions