mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-30 10:18:02 +08:00
fix(components): [dropdown] ignore show/hide timeouts for click trigger (#6720)
This commit is contained in:
parent
e4c6f6d0d9
commit
b61dc63375
@ -568,4 +568,50 @@ describe('Dropdown', () => {
|
||||
.classes()
|
||||
).toContain('is-disabled')
|
||||
})
|
||||
|
||||
test('set show-timeout/hide-timeout when trigger is hover', async () => {
|
||||
const wrapper = _mount(
|
||||
`
|
||||
<el-dropdown trigger="hover" :show-timeout="200" :hide-timeout="300">
|
||||
<span class="el-dropdown-link">
|
||||
Dropdown List
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item>Item</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
`,
|
||||
() => ({})
|
||||
)
|
||||
const tooltipElement = wrapper.getComponent({
|
||||
name: 'ElTooltip',
|
||||
})
|
||||
expect(tooltipElement.vm.showAfter).toBe(200)
|
||||
expect(tooltipElement.vm.hideAfter).toBe(300)
|
||||
})
|
||||
|
||||
test('ignore show-timeout/hide-timeout when trigger is not hover', async () => {
|
||||
const wrapper = _mount(
|
||||
`
|
||||
<el-dropdown trigger="click" :show-timeout="200" :hide-timeout="300">
|
||||
<span class="el-dropdown-link">
|
||||
Dropdown List
|
||||
</span>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item>Item</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
`,
|
||||
() => ({})
|
||||
)
|
||||
const tooltipElement = wrapper.getComponent({
|
||||
name: 'ElTooltip',
|
||||
})
|
||||
expect(tooltipElement.vm.showAfter).toBe(0)
|
||||
expect(tooltipElement.vm.hideAfter).toBe(0)
|
||||
})
|
||||
})
|
||||
|
@ -6,13 +6,13 @@
|
||||
:fallback-placements="['bottom', 'top']"
|
||||
:popper-options="popperOptions"
|
||||
:gpu-acceleration="false"
|
||||
:hide-after="hideTimeout"
|
||||
:hide-after="trigger === 'hover' ? hideTimeout : 0"
|
||||
:manual-mode="true"
|
||||
:placement="placement"
|
||||
:popper-class="[ns.e('popper'), popperClass]"
|
||||
:reference-element="referenceElementRef?.$el"
|
||||
:trigger="trigger"
|
||||
:show-after="showTimeout"
|
||||
:show-after="trigger === 'hover' ? showTimeout : 0"
|
||||
:stop-popper-mouse-event="false"
|
||||
:virtual-ref="triggeringElementRef"
|
||||
:virtual-triggering="splitButton"
|
||||
|
Loading…
Reference in New Issue
Block a user