Files
SRCmail/components/ui/__tests__/input.test.tsx
T
Matthieu MALVACHEandMatthieu MALVACHE fb414bf2c9 feat: add contacts phase 2, advanced search, vacation responder, Docker & TOTP 2FA
- Contact groups/lists, vCard import/export (RFC 6350), bulk operations
- Advanced search with JMAP filter panel, search chips, cross-mailbox queries
- Vacation responder with JMAP VacationResponse, settings tab, sidebar indicator
- TOTP two-factor authentication support
- Docker multi-stage build with standalone output and docker-compose
- CSP Report-Only headers and security headers via proxy middleware
- Virtual scrolling for large email lists
- Structured server-side logger (text/JSON, configurable level)
- 450+ tests (contacts, vCard, threads, headers, identity, components)
- Playwright E2E framework setup
- Updated README and ROADMAP with all new features
2026-02-16 18:51:30 +01:00

29 lines
985 B
TypeScript

import { render, screen, fireEvent } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import { Input } from '../input';
describe('Input', () => {
it('renders with placeholder', () => {
render(<Input placeholder="Enter text" />);
expect(screen.getByPlaceholderText('Enter text')).toBeInTheDocument();
});
it('handles value changes', () => {
const onChange = vi.fn();
render(<Input onChange={onChange} />);
fireEvent.change(screen.getByRole('textbox'), { target: { value: 'hello' } });
expect(onChange).toHaveBeenCalledOnce();
});
it('applies disabled state', () => {
render(<Input disabled placeholder="Disabled" />);
expect(screen.getByPlaceholderText('Disabled')).toBeDisabled();
});
it('passes type prop', () => {
render(<Input type="password" placeholder="Password" />);
const input = screen.getByPlaceholderText('Password');
expect(input).toHaveAttribute('type', 'password');
});
});