mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-25 01:10:40 +01:00
feat(Form): new component (#4)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
28
test/components/Input.spec.ts
Normal file
28
test/components/Input.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user