@@ -15,10 +15,13 @@ Vue.use(Vuetify)
15
15
// Vuetify requires you to wrap your app with a v-app component that provides
16
16
// a <div data-app="true"> node.
17
17
const renderWithVuetify = ( component , options , callback ) => {
18
+ const root = document . createElement ( 'div' )
19
+ root . setAttribute ( 'data-app' , 'true' )
20
+
18
21
return render (
19
22
component ,
20
23
{
21
- container : document . createElement ( 'div' ) . setAttribute ( 'data-app' , 'true' ) ,
24
+ container : document . body . appendChild ( root ) ,
22
25
// for Vuetify components that use the $vuetify instance property
23
26
vuetify : new Vuetify ( ) ,
24
27
...options ,
@@ -27,6 +30,12 @@ const renderWithVuetify = (component, options, callback) => {
27
30
)
28
31
}
29
32
33
+ test ( 'should set [data-app] attribute on outer most div' , ( ) => {
34
+ const { container} = renderWithVuetify ( VuetifyDemoComponent )
35
+
36
+ expect ( container . getAttribute ( 'data-app' ) ) . toEqual ( 'true' )
37
+ } )
38
+
30
39
test ( 'renders a Vuetify-powered component' , async ( ) => {
31
40
const { getByText} = renderWithVuetify ( VuetifyDemoComponent )
32
41
@@ -50,3 +59,15 @@ test('allows changing props', async () => {
50
59
51
60
expect ( queryByText ( 'This is a hint' ) ) . toBeInTheDocument ( )
52
61
} )
62
+
63
+ test ( 'opens a menu' , async ( ) => {
64
+ const { getByText, queryByText} = renderWithVuetify ( VuetifyDemoComponent )
65
+
66
+ await fireEvent . click ( getByText ( 'menu' ) )
67
+
68
+ const menuItem = queryByText ( 'menu item' )
69
+ expect ( menuItem ) . toBeInTheDocument ( )
70
+
71
+ await fireEvent . click ( menuItem )
72
+ expect ( queryByText ( 'menu item' ) ) . not . toBeInTheDocument ( )
73
+ } )
0 commit comments