23 lines
752 B
TypeScript
23 lines
752 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { Input } from '../src/lib'
|
|
|
|
describe('Input', () => {
|
|
it('renders a native input element', () => {
|
|
const wrapper = mount(Input)
|
|
expect(wrapper.element.tagName).toBe('INPUT')
|
|
})
|
|
|
|
it('supports v-model', async () => {
|
|
const wrapper = mount(Input, { props: { modelValue: 'Styx' } })
|
|
expect((wrapper.element as HTMLInputElement).value).toBe('Styx')
|
|
|
|
await wrapper.setValue('Lethe')
|
|
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual(['Lethe'])
|
|
})
|
|
|
|
it('applies the disabled attribute', () => {
|
|
const wrapper = mount(Input, { attrs: { disabled: true } })
|
|
expect(wrapper.attributes('disabled')).toBeDefined()
|
|
})
|
|
})
|