File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 6262 "apollo-client" : " ^2.6.10" ,
6363 "axios" : " ^0.20.0" ,
6464 "dtslint" : " ^4.0.6" ,
65+ "element-plus" : " ^1.0.1-beta.7" ,
6566 "eslint-plugin-vue" : " ^7.1.0" ,
6667 "graphql" : " ^15.4.0" ,
6768 "graphql-tag" : " ^2.11.0" ,
Original file line number Diff line number Diff line change 1+ import ElementPlus from 'element-plus'
2+ import { defineComponent } from 'vue'
3+ import userEvent from '@testing-library/user-event'
4+ import '@testing-library/jest-dom'
5+ import { render , screen , waitFor } from '..'
6+
7+ const Component = defineComponent ( {
8+ template : `
9+ <el-popover trigger="hover" content="this is content">
10+ <template #reference>
11+ <el-button>Hover to activate</el-button>
12+ </template>
13+ </el-popover>
14+ ` ,
15+ } )
16+
17+ test ( 'Stubs out a component' , async ( ) => {
18+ render ( Component , {
19+ global : {
20+ plugins : [ ElementPlus ] ,
21+ } ,
22+ } )
23+
24+ const button = screen . getByText ( 'Hover to activate' )
25+ const getContent = ( ) => screen . getByText ( 'this is content' )
26+
27+ expect ( getContent ( ) ) . toBeInTheDocument ( )
28+ expect ( getContent ( ) ) . not . toBeVisible ( )
29+
30+ userEvent . hover ( button )
31+
32+ await waitFor ( ( ) => expect ( getContent ( ) ) . toBeVisible ( ) )
33+
34+ userEvent . unhover ( button )
35+
36+ await waitFor ( ( ) => expect ( getContent ( ) ) . not . toBeVisible ( ) )
37+ } )
You can’t perform that action at this time.
0 commit comments