test: lint

This commit is contained in:
Benjamin Canac
2024-04-12 14:00:58 +02:00
parent 9993b6727a
commit 290e4ce150
6 changed files with 40 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, test } from 'vitest'
import { mount } from '@vue/test-utils'
import Textarea, { type TextareaProps } from '../../src/runtime/components/Textarea.vue'
import ComponentRender from '../component-render'
import { mount } from '@vue/test-utils'
describe('Textarea', () => {
it.each([
@@ -12,26 +12,25 @@ describe('Textarea', () => {
['with required', { props: { required: true } }],
['with disabled', { props: { disabled: true } }],
['with rows', { props: { rows: 5 } }],
['with size', { props: { size: 'sm' } }],
['with color', { props: { color: 'blue' } }],
['with size', { props: { size: 'sm' as const } }],
['with color', { props: { color: 'blue' as const } }],
['with size 2xs', { props: { size: '2xs' as const } }],
['with size xs', { props: { size: 'xs' as const } }],
['with size sm', { props: { size: 'sm' as const } }],
['with size md', { props: { size: 'md' as const } }],
['with size lg', { props: { size: 'lg' as const } }],
['with size xl', { props: { size: 'xl' as const } }],
['with variant', { variant: 'outline' }],
['with variant', { props: { variant: 'outline' as const } }],
['with default slot', { slots: { default: () => 'Default slot' } }]
// @ts-ignore
])('renders %s correctly', async (nameOrHtml: string, options: { props: TextareaProps, slots?: any }) => {
])('renders %s correctly', async (nameOrHtml: string, options: { props?: TextareaProps, slots?: any }) => {
const html = await ComponentRender(nameOrHtml, options, Textarea)
expect(html).toMatchSnapshot()
})
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' } ]
['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 mount(Textarea, {
...options