-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathvuetify.js
33 lines (28 loc) · 1.08 KB
/
vuetify.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import Vue from 'vue'
import {render, fireEvent} from '@testing-library/vue'
import Vuetify from 'vuetify'
import VuetifyDemoComponent from './components/Vuetify'
// We need to use a global Vue instance, otherwise Vuetify will complain about
// read-only attributes.
// More info: https://github.com/vuetifyjs/vuetify/issues/4068
// https://vuetifyjs.com/en/getting-started/unit-testing
Vue.use(Vuetify)
// Vuetify requires you to wrap you app with a v-app component that provides
// a <div data-app="true"> node. So you can do that, or you can also set the
// attribute to the DOM.
document.body.setAttribute('data-app', true)
// Another solution is to create a custom renderer that provides all the
// environment required by Vuetify.
test('renders a Vuetify-powered component', async () => {
const {getByText} = render(VuetifyDemoComponent, {
vuetify: new Vuetify(),
})
await fireEvent.click(getByText('open'))
expect(getByText('Lorem ipsum dolor sit amet.')).toMatchInlineSnapshot(`
<div
class="v-card__text"
>
Lorem ipsum dolor sit amet.
</div>
`)
})