mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-12 10:45:10 +08:00
parent
abe02101fa
commit
3bbcec8a10
@ -519,6 +519,29 @@ describe('Select', () => {
|
||||
expect(handleBlur).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('event:focus & blur for multile & filterable select', async () => {
|
||||
const handleFocus = jest.fn()
|
||||
const handleBlur = jest.fn()
|
||||
const wrapper = _mount(`
|
||||
<el-select
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
multiple
|
||||
filterable
|
||||
/>`, () => ({
|
||||
handleFocus,
|
||||
handleBlur,
|
||||
}))
|
||||
const select = wrapper.findComponent(({ name: 'ElSelect' }))
|
||||
const input = select.find('input')
|
||||
|
||||
expect(input.exists()).toBe(true)
|
||||
await input.trigger('focus')
|
||||
expect(handleFocus).toHaveBeenCalled()
|
||||
await input.trigger('blur')
|
||||
expect(handleBlur).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('should not open popper when automatic-dropdown not set', async () => {
|
||||
const wrapper = getSelectVm()
|
||||
const select = wrapper.findComponent({ name: 'ElSelect' })
|
||||
|
@ -79,7 +79,7 @@
|
||||
:autocomplete="autocomplete"
|
||||
:style="{ 'flex-grow': '1', width: inputLength / (inputWidth - 32) + '%', 'max-width': inputWidth - 42 + 'px' }"
|
||||
@focus="handleFocus"
|
||||
@blur="softFocus = false"
|
||||
@blur="handleBlur"
|
||||
@keyup="managePlaceholder"
|
||||
@keydown="resetInputState"
|
||||
@keydown.down.prevent="navigateOptions('next')"
|
||||
|
Loading…
Reference in New Issue
Block a user