import { cleanup, render, screen } from '@testing-library/react' import { afterEach, describe, expect, it } from 'vitest' import { ConsumerFormActions, ConsumerFormSection, ConsumerFormShell } from '@/components/forms/ConsumerFormLayout' afterEach(cleanup) describe('ConsumerFormLayout', () => { it('provides a labelled surface for related fields', () => { render( ) expect(screen.getByRole('heading', { level: 2, name: 'اطلاعات شخصی' })).toBeInTheDocument() expect(screen.getByText('توضیح بخش')).toBeInTheDocument() expect(screen.getByRole('textbox', { name: 'نام' })).toBeInTheDocument() }) it('keeps helper content next to form actions', () => { render( تغییرات ذخیره‌نشده دارید}> ) expect(screen.getByText('تغییرات ذخیره‌نشده دارید')).toBeInTheDocument() expect(screen.getByRole('button', { name: 'ذخیره' })).toBeInTheDocument() }) it('provides one consistent shell for task-oriented consumer forms', () => { render( مرحله ۱ از ۴} status="ذخیره خودکار" title="ساخت رویداد" utilityAction={} >

محتوای فرم

) expect(screen.getByRole('heading', { level: 1, name: 'ساخت رویداد' })).toBeInTheDocument() expect(screen.getByText('ذخیره خودکار')).toBeInTheDocument() expect(screen.getByText('مرحله ۱ از ۴')).toBeInTheDocument() expect(screen.getByRole('button', { name: 'شروع از ابتدا' })).toBeInTheDocument() }) it('can keep form chrome static while the body scrolls independently', () => { const { container } = render( مراحل ساخت} title="ساخت رویداد" >

محتوای بلند فرم

) const scrollport = container.querySelector('.overflow-y-auto') expect(scrollport).toHaveTextContent('محتوای بلند فرم') expect(scrollport).not.toContainElement(screen.getByText('مراحل ساخت')) }) })