mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-06 05:09:00 +08:00
e4bb9daf4f
* fix(select): Fix select.focus is undefined bug * fix(select): Add hook test Co-authored-by: bastarder <jie.qian@blockheaders.com>
18 lines
371 B
TypeScript
18 lines
371 B
TypeScript
import { ref } from 'vue'
|
|
import useFocus from '../use-focus'
|
|
|
|
describe('useFocus', () => {
|
|
it('should focus el', async () => {
|
|
const inputEl = document.createElement('input')
|
|
document.body.appendChild(inputEl)
|
|
|
|
const reference = ref(inputEl)
|
|
const { focus } = useFocus(reference)
|
|
|
|
focus()
|
|
|
|
expect(document.activeElement).toBe(inputEl)
|
|
})
|
|
})
|
|
|