Vuetify: Custom component unit tests display warning "missing <v-app>"

Created on 2 Aug 2017  路  2Comments  路  Source: vuetifyjs/vuetify

Steps to reproduce

Run karma unit tests for custom components which contains v-dialog or v-menu.

Versions

vuetify 0.14.7
vue 2.4.2

What is expected ?

All test should pass without any error or warning

What is actually happening ?

When testing components which contains v-dialog or v-menu (both using detachable mixin), the warning Application is missing <v-app> component. keeps displaying

Reproduction Link

I created simple repo with three tests (using vue init vuetify/webpack + karma unit tests)
https://github.com/lattam/vuetify-test-example

  • clone it, npm install, npm run unit

Note: In Menu.spec.js I tried to wrap the component into <v-app> element, but the warning keeps displaying.

Thanks for any help!

Most helpful comment

Add the following code to your test/unit/index.js file

var app = document.createElement('div')
app.setAttribute('data-app', true)
document.body.appendChild(app)

That way there will always be a div with data-app attribute in your tests for components to use

All 2 comments

Add the following code to your test/unit/index.js file

var app = document.createElement('div')
app.setAttribute('data-app', true)
document.body.appendChild(app)

That way there will always be a div with data-app attribute in your tests for components to use

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tcastelly picture tcastelly  路  41Comments

thearabbit picture thearabbit  路  31Comments

DeepDiver1975 picture DeepDiver1975  路  32Comments

MatthewAry picture MatthewAry  路  33Comments

amesas picture amesas  路  81Comments