import { describe, it, expect } from 'vitest' import { pageSchema, type Page } from '@/lib/schema/page' import { exportPage } from '@/lib/exporter/html' const makePage = (overrides: Partial = {}): Page => pageSchema.parse({ title: 'Validate', locale: 'en', theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' }, sections: [], form: { actionUrl: '', fields: [ { type: 'text', name: 'name', label: 'Name', required: true, pattern: '^[A-Za-z ]+$', maxLength: 30 }, { type: 'email', name: 'email', label: 'Email', required: true }, { type: 'textarea', name: 'msg', label: 'Message', required: false, maxLength: 200 }, ], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 }, }, seo: { title: 'Validate', description: 'desc' }, ...overrides, }) describe('Exporter - field validation attributes', () => { it('text에 pattern/maxLength, textarea에 maxLength를 렌더링한다', () => { const page = makePage() const out = exportPage(page) // text: pattern + maxlength expect(out.html).toContain('name="name"') expect(out.html).toContain('pattern="^[A-Za-z ]+$"') expect(out.html).toContain('maxlength="30"') // textarea: maxlength expect(out.html).toContain('