element-plus/packages/hooks/__tests__/use-focus.test.ts
三咲智子 1d13ebb05d
feat: drop jest (#7248)
* feat: drop jest

* test: remove ssr

* test: rename

* chore: update tsconfig
2022-04-19 16:51:44 +08:00

18 lines
420 B
TypeScript

import { ref } from 'vue'
import { describe, expect, it } from 'vitest'
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)
})
})