diff options
| author | Bertrand Yuan <noreply@bertyuan.com> | 2026-03-26 00:02:16 +0800 |
|---|---|---|
| committer | Bertrand Yuan <noreply@bertyuan.com> | 2026-03-26 00:02:16 +0800 |
| commit | 8a6a6712e7554f110b5ef951f270d88fd010e040 (patch) | |
| tree | 12cb86b1ede55e15600ef7f139ef7ec91b9fa8a1 /src/components/ui/input.test.tsx | |
| parent | f7a02fe0e112cf108fc5f22872f1efc077e99fe8 (diff) | |
add more tests
Diffstat (limited to 'src/components/ui/input.test.tsx')
| -rw-r--r-- | src/components/ui/input.test.tsx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/components/ui/input.test.tsx b/src/components/ui/input.test.tsx new file mode 100644 index 0000000..aabe76f --- /dev/null +++ b/src/components/ui/input.test.tsx @@ -0,0 +1,22 @@ +import { render, screen } from '@testing-library/react'; +import { describe, expect, test } from 'vitest'; +import { Input } from './input'; + +describe('Input', () => { + test('renders an input with the expected slot attribute', () => { + render(<Input aria-label='Email' />); + + const input = screen.getByLabelText('Email'); + expect(input).toBeInTheDocument(); + expect(input).toHaveAttribute('data-slot', 'input'); + }); + + test('supports input type and disabled props', () => { + render(<Input aria-label='Password' type='password' disabled />); + + const input = screen.getByLabelText('Password'); + expect(input).toHaveAttribute('type', 'password'); + expect(input).toBeDisabled(); + }); +}); + |
