18 lines
607 B
TypeScript
18 lines
607 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { Textarea } from '../src/lib'
|
|
|
|
describe('Textarea', () => {
|
|
it('renders a native textarea element', () => {
|
|
const wrapper = mount(Textarea)
|
|
expect(wrapper.element.tagName).toBe('TEXTAREA')
|
|
})
|
|
|
|
it('supports v-model', async () => {
|
|
const wrapper = mount(Textarea, { props: { modelValue: 'An omen' } })
|
|
expect((wrapper.element as HTMLTextAreaElement).value).toBe('An omen')
|
|
|
|
await wrapper.setValue('A crow')
|
|
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual(['A crow'])
|
|
})
|
|
})
|