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 56e0152

Browse files
committed
docs: Add example for external UI library
1 parent 11bf948 commit 56e0152

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

‎package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
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",

‎src/__tests__/element-plus.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
})

0 commit comments

Comments
(0)

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