import { describe, it, expect, vi } from 'vitest' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { Input } from './input' describe('Input', () => { it('renders input element', () => { render() expect(screen.getByPlaceholderText('Enter text')).toBeInTheDocument() }) it('handles text input', async () => { const user = userEvent.setup() render() const input = screen.getByPlaceholderText('Type here') await user.type(input, 'hello') expect(input).toHaveValue('hello') }) it('renders with type password', () => { render() expect(screen.getByPlaceholderText('Password')).toHaveAttribute('type', 'password') }) it('renders as disabled', () => { render() expect(screen.getByPlaceholderText('Disabled')).toBeDisabled() }) it('calls onChange handler', async () => { const user = userEvent.setup() const onChange = vi.fn() render() await user.type(screen.getByPlaceholderText('Input'), 'a') expect(onChange).toHaveBeenCalled() }) it('applies custom className', () => { render() expect(screen.getByPlaceholderText('Custom').className).toContain('my-custom-class') }) it('has correct displayName', () => { expect(Input.displayName).toBe('Input') }) })