Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(components): [select-v2] with teleported="false" dropdown closes abnormally #16714

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions packages/components/select-v2/__tests__/select.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ describe('Select', () => {
DEFAULT_PLACEHOLDER
)
const select = wrapper.findComponent(Select)
await wrapper.trigger('click')
const tipDefWrapper = wrapper.find(`.${WRAPPER_CLASS_NAME}`)
await tipDefWrapper.trigger('click')
expect((select.vm as any).expanded).toBeTruthy()
})

Expand Down Expand Up @@ -465,7 +466,8 @@ describe('Select', () => {
})
await nextTick()
const vm = wrapper.vm as any
await wrapper.trigger('click')
const tipDefWrapper = wrapper.find(`.${WRAPPER_CLASS_NAME}`)
await tipDefWrapper.trigger('click')
await nextTick()
expect(vm.visible).toBeTruthy()
})
Expand Down Expand Up @@ -1541,7 +1543,8 @@ describe('Select', () => {
const select = wrapper.findComponent(Select)
const selectVm = select.vm as any
const vm = wrapper.vm as any
await wrapper.trigger('click')
const tipDefWrapper = wrapper.find(`.${WRAPPER_CLASS_NAME}`)
await tipDefWrapper.trigger('click')
await nextTick()
expect(selectVm.states.hoveringIndex).toBe(-1)
// should skip the disabled option
Expand Down Expand Up @@ -1634,7 +1637,8 @@ describe('Select', () => {
const wrapper = createSelect()
await nextTick()
const select = wrapper.findComponent(Select)
await wrapper.trigger('click')
const tipDefWrapper = wrapper.find(`.${WRAPPER_CLASS_NAME}`)
await tipDefWrapper.trigger('click')
expect((select.vm as any).expanded).toBeTruthy()
const box = document.querySelector<HTMLElement>('.el-vl__wrapper')
expect(hasClass(box, 'always-on')).toBe(false)
Expand All @@ -1650,7 +1654,8 @@ describe('Select', () => {
})
await nextTick()
const select = wrapper.findComponent(Select)
await wrapper.trigger('click')
const tipDefWrapper = wrapper.find(`.${WRAPPER_CLASS_NAME}`)
await tipDefWrapper.trigger('click')
expect((select.vm as any).expanded).toBeTruthy()
const box = document.querySelector<HTMLElement>('.el-vl__wrapper')
expect(hasClass(box, 'always-on')).toBe(true)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/select-v2/src/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
:class="[nsSelect.b(), nsSelect.m(selectSize)]"
@mouseenter="states.inputHovering = true"
@mouseleave="states.inputHovering = false"
@click.prevent.stop="toggleMenu"
>
<el-tooltip
ref="tooltipRef"
Expand Down Expand Up @@ -35,6 +34,7 @@
nsSelect.is('filterable', filterable),
nsSelect.is('disabled', selectDisabled),
]"
@click.prevent.stop="toggleMenu"
>
<div
v-if="$slots.prefix"
Expand Down
Loading