File tree Expand file tree Collapse file tree 1 file changed +4
-22
lines changed Expand file tree Collapse file tree 1 file changed +4
-22
lines changed Original file line number Diff line number Diff line change 11import ElementPlus from 'element-plus'
22import { defineComponent } from 'vue'
3- import userEvent from '@testing-library/user-event'
43import '@testing-library/jest-dom'
5- import { render , screen , waitFor } from '..'
4+ import { render , screen } from '..'
65
76const Component = defineComponent ( {
87 template : `
9- <el-popover trigger="click" content="this is content">
10- <template #reference>
11- <el-button>Click to activate</el-button>
12- </template>
13- </el-popover>
14- ` ,
8+ <el-alert title="success alert" type="success" />` ,
159} )
1610
17- test ( 'Stubs out a component ' , async ( ) => {
11+ test ( 'Renders component from third-party library ' , async ( ) => {
1812 render ( Component , {
1913 global : {
2014 plugins : [ ElementPlus ] ,
2115 } ,
2216 } )
2317
24- const button = screen . getByRole ( 'button' )
25- const getContent = ( ) => screen . getByText ( 'this is content' )
26-
27- expect ( getContent ( ) ) . toBeInTheDocument ( )
28- expect ( getContent ( ) ) . not . toBeVisible ( )
29-
30- userEvent . click ( button )
31-
32- await waitFor ( ( ) => expect ( getContent ( ) ) . toBeVisible ( ) )
33-
34- userEvent . click ( button )
35-
36- await waitFor ( ( ) => expect ( getContent ( ) ) . not . toBeVisible ( ) )
18+ expect ( screen . getByRole ( 'alert' ) ) . toHaveTextContent ( 'success alert' )
3719} )
You can’t perform that action at this time.
0 commit comments