mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 18:01:24 +08:00
df57ddfe39
- Fix the issue that dropdown with trigger 'click' cannot be closed when clicking outside content - Fix the same issue for popover popconfirm - Remove useless code from `el-tooltip-content` which can be much simpler - Use `onClick` to replace `onMousedown` because `onMousedown` is triggered prior than `onClick` - Adjust test cases against these changes above
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { h, nextTick } from 'vue'
|
|
import { mount } from '@vue/test-utils'
|
|
import { rAF } from '@element-plus/test-utils/tick'
|
|
import ElPopconfirm from '../src/popconfirm.vue'
|
|
|
|
const AXIOM = 'rem is the best girl'
|
|
const selector = '.el-popper'
|
|
const _mount = (props: any = {}) =>
|
|
mount(ElPopconfirm, {
|
|
props: {
|
|
...props,
|
|
},
|
|
slots: {
|
|
reference: () =>
|
|
h(
|
|
'div',
|
|
{
|
|
class: 'reference',
|
|
},
|
|
[AXIOM]
|
|
),
|
|
},
|
|
attachTo: 'body',
|
|
})
|
|
|
|
describe('Popconfirm.vue', () => {
|
|
afterEach(() => {
|
|
document.body.innerHTML = ''
|
|
})
|
|
|
|
test('render test', async () => {
|
|
const wrapper = _mount()
|
|
await nextTick()
|
|
const trigger = wrapper.find('.reference')
|
|
|
|
expect(document.querySelector(selector)!.getAttribute('style')).toContain(
|
|
'display: none'
|
|
)
|
|
|
|
await trigger.trigger('click', {
|
|
button: 0,
|
|
})
|
|
|
|
await nextTick()
|
|
await rAF()
|
|
|
|
expect(
|
|
document.querySelector(selector)!.getAttribute('style')
|
|
).not.toContain('display: none')
|
|
})
|
|
})
|