import { render, screen } from '@testing-library/react'; import { describe, expect, it } from 'vitest'; import { Form } from '../../src/components/Form'; describe('Form', () => { it('renders title, title actions and children', () => { render(
Action}>
Form child
, ); expect(screen.getByText('User Details')).toBeInTheDocument(); expect(screen.getByRole('button', { name: 'Action' })).toBeInTheDocument(); expect(screen.getByText('Form child')).toBeInTheDocument(); }); it('supports custom class names and optional title actions', () => { const { container } = render(
Child
, ); expect(container.firstElementChild).toHaveClass('form-custom'); expect(screen.queryByRole('button')).not.toBeInTheDocument(); }); });