mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
aaf90d99d0
* test: use vitest * test: add script and ci * chore: improve tsconfig * refactor: use-form-item * fix: remove unused * chore: improve scripts * test: improve mock * refactor: change coverage
18 lines
420 B
TypeScript
18 lines
420 B
TypeScript
import { ref } from 'vue'
|
|
import { describe, it, expect } 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)
|
|
})
|
|
})
|