24 lines
615 B
TypeScript
24 lines
615 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import Input from './Input.vue'
|
|
|
|
describe('MalioInput', () => {
|
|
it('affiche la valeur initiale', () => {
|
|
const wrapper = mount(Input, {
|
|
props: { modelValue: 'hello' },
|
|
})
|
|
|
|
expect(wrapper.get('input').element.value).toBe('hello')
|
|
})
|
|
|
|
it('emet update:modelValue au changement', async () => {
|
|
const wrapper = mount(Input, {
|
|
props: { modelValue: '' },
|
|
})
|
|
|
|
await wrapper.get('input').setValue('new value')
|
|
|
|
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual(['new value'])
|
|
})
|
|
})
|