element-plus/packages/components/popconfirm/__test__/popconfirm.spec.ts
三咲智子 55348b30b6
style: use prettier (#3228)
* style: use prettier

* style: just prettier format, no code changes

* style: eslint fix
object-shorthand, prefer-const

* style: fix no-void

* style: no-console
2021-09-04 19:29:28 +08:00

34 lines
751 B
TypeScript

import { h } from 'vue'
import { mount } from '@vue/test-utils'
import ElPopconfirm from '../src/index.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')
})
})