import { ErrorSummary } from '@/components/forms/ErrorSummary';
import { FormField } from '@/components/forms/FormField';
import { TextInput } from '@/components/forms/TextInput';
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
describe('form primitives', () => {
it('associates labels, help, required state, and errors', () => {
render(
,
);
const input = screen.getByLabelText(/Work email/);
expect(input).toHaveAttribute('required');
expect(input).toHaveAttribute('aria-invalid', 'true');
expect(input).toHaveAccessibleDescription('Use work email Enter a valid address');
});
it('links summary errors back to fields', () => {
render(
,
);
expect(screen.getByRole('alert').querySelector('a')).toHaveAttribute('href', '#work-email');
});
});