mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 18:01:24 +08:00
fbebf03d8c
* refactor(components): refactor popconfirm * fix(components): fix path * chore: change name * fix
34 lines
756 B
TypeScript
34 lines
756 B
TypeScript
import { h } from 'vue'
|
|
import { mount } from '@vue/test-utils'
|
|
import ElPopconfirm from '../src/popconfirm.vue'
|
|
|
|
const selector = '.el-popper'
|
|
const _mount = (props: any = {}) =>
|
|
mount(ElPopconfirm, {
|
|
props,
|
|
slots: {
|
|
reference: () =>
|
|
h('div', {
|
|
class: 'reference',
|
|
}),
|
|
},
|
|
attachTo: 'body',
|
|
})
|
|
|
|
describe('Popconfirm.vue', () => {
|
|
test('render test', async () => {
|
|
const wrapper = _mount()
|
|
const trigger = wrapper.find('.reference')
|
|
|
|
expect(document.querySelector(selector).getAttribute('style')).toContain(
|
|
'display: none'
|
|
)
|
|
|
|
await trigger.trigger('click')
|
|
|
|
expect(
|
|
document.querySelector(selector).getAttribute('style')
|
|
).not.toContain('display: none')
|
|
})
|
|
})
|