Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 631527d

Browse files
committed
chore: fix element-plus test
1 parent ed995e8 commit 631527d

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

‎src/__tests__/element-plus.js‎

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,19 @@
11
import ElementPlus from 'element-plus'
22
import {defineComponent} from 'vue'
3-
import userEvent from '@testing-library/user-event'
43
import '@testing-library/jest-dom'
5-
import {render, screen,waitFor} from '..'
4+
import {render, screen} from '..'
65

76
const 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
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /