Nychthemeron/packages/library/tests/Input.spec.ts
Matthew L McPeak f3002c7eb1 feat: migrate InputText to shadcn-vue Input
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-11 14:22:14 -04:00

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