element-plus/packages/hooks/__tests__/use-focus.spec.ts
bastarder e4bb9daf4f
fix(select): Fix select.focus is undefined bug (#862)
* fix(select): Fix select.focus is undefined bug

* fix(select): Add hook test

Co-authored-by: bastarder <jie.qian@blockheaders.com>
2020-12-07 11:29:08 +08:00

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)
})
})