mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
test(Input): use mount to access defineModel events
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, test } from 'vitest'
|
||||
import Input, { type InputProps } from '../../src/runtime/components/Input.vue'
|
||||
import ComponentRender from '../component-render'
|
||||
import { mountSuspended } from '@nuxt/test-utils/runtime'
|
||||
import { mount } from '@vue/test-utils'
|
||||
|
||||
describe('Input', () => {
|
||||
it.each([
|
||||
@@ -32,13 +32,12 @@ describe('Input', () => {
|
||||
expect(html).toMatchSnapshot()
|
||||
})
|
||||
|
||||
// See: https://github.com/nuxt/test-utils/issues/572
|
||||
it.skip.each([
|
||||
it.each([
|
||||
['with .trim modifier', { props: { modelModifiers: { trim: true } } }, { input: 'input ', expected: 'input' } ],
|
||||
['with .number modifier', { props: { modelModifiers: { number: true } } }, { input: '42', expected: 42 } ],
|
||||
['with .lazy modifier', { props: { modelModifiers: { lazy: true } } }, { input: 'input', expected: 'input' } ]
|
||||
])('%s works', async (_nameOrHtml: string, options: { props?: any, slots?: any }, spec: { input: any, expected: any }) => {
|
||||
const wrapper = await mountSuspended(Input, {
|
||||
const wrapper = mount(Input, {
|
||||
...options
|
||||
})
|
||||
|
||||
@@ -48,9 +47,8 @@ describe('Input', () => {
|
||||
expect(wrapper.emitted()).toMatchObject({ 'update:modelValue': [[spec.expected]] })
|
||||
})
|
||||
|
||||
// See: https://github.com/nuxt/test-utils/issues/572
|
||||
test.skip('with .lazy modifier updates on change only', async () => {
|
||||
const wrapper = await mountSuspended(Input, {
|
||||
test('with .lazy modifier updates on change only', async () => {
|
||||
const wrapper = mount(Input, {
|
||||
props: {
|
||||
modelModifiers: { lazy: true }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user