Files
ui/test/components/Input.spec.ts
Romain Hamel de62676647 feat(Form): new component (#4)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2024-03-19 16:09:12 +01:00

29 lines
1.6 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import Input, { type InputProps } from '../../src/runtime/components/Input.vue'
import ComponentRender from '../component-render'
describe('Input', () => {
it.each([
['basic case', {}],
['with name', { props: { name: 'username' } }],
['with type', { props: { type: 'password' } }],
['with placeholder', { props: { placeholder: 'Enter your username' } }],
['with disabled', { props: { disabled: true } }],
['with required', { props: { required: true } }],
// ['with icon', { props: { icon: 'i-heroicons-battery-50-solid' } }],
// ['with leading and icon', { props: { leading: true, icon: 'i-heroicons-battery-50-solid' } }],
// ['with leadingIcon', { props: { leadingIcon: 'i-heroicons-battery-50-solid' } }],
// ['with loading icon', { props: { loading: true } }],
// ['with leading slot', { slots: { leading: () => 'leading slot' } }],
// ['with trailing and icon', { props: { trailing: true, icon: 'i-heroicons-battery-50-solid' } }],
// ['with trailingIcon', { props: { trailingIcon: 'i-heroicons-battery-50-solid' } }],
// ['with trailing slot', { slots: { leading: () => 'trailing slot' } }],
['with size', { props: { size: 'xs' as const } }],
['with color', { props: { color: 'red' as const } }],
['with variant', { props: { variant: 'outline' as const } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: InputProps, slots?: any }) => {
const html = await ComponentRender(nameOrHtml, options, Input)
expect(html).toMatchSnapshot()
})
})