@@ -15,10 +15,13 @@ Vue.use(Vuetify)
1515// Vuetify requires you to wrap your app with a v-app component that provides
1616// a <div data-app="true"> node.
1717const renderWithVuetify = ( component , options , callback ) => {
18+ const root = document . createElement ( 'div' )
19+ root . setAttribute ( 'data-app' , 'true' )
20+
1821 return render (
1922 component ,
2023 {
21- container : document . createElement ( 'div' ) . setAttribute ( 'data-app' , 'true' ) ,
24+ container : document . body . appendChild ( root ) ,
2225 // for Vuetify components that use the $vuetify instance property
2326 vuetify : new Vuetify ( ) ,
2427 ...options ,
@@ -27,6 +30,12 @@ const renderWithVuetify = (component, options, callback) => {
2730 )
2831}
2932
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+
3039test ( 'renders a Vuetify-powered component' , async ( ) => {
3140 const { getByText} = renderWithVuetify ( VuetifyDemoComponent )
3241
@@ -50,3 +59,15 @@ test('allows changing props', async () => {
5059
5160 expect ( queryByText ( 'This is a hint' ) ) . toBeInTheDocument ( )
5261} )
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