Files
landing-builder/lib/exporter/contrastFontTokens.test.ts
T

27 lines
1.0 KiB
TypeScript

import { describe, expect, test } from 'vitest'
import { exportPage } from './html'
import { pageSchema, type Page } from '@/lib/schema/page'
const makePage = (): Page =>
pageSchema.parse({
title: 'T',
locale: 'en',
theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' },
sections: [],
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
seo: { title: 'T', description: 'D' },
})
describe('Exporter CSS contrast/font tokens', () => {
test('contains base text color and responsive font adjustments', () => {
const out = exportPage(makePage())
// base body text color token present
expect(out.css).toMatch(/body\{[^}]*color:\s*#0f172a/i)
// focus outline thickness and offset present
expect(out.css).toMatch(/outline:\s*3px\s*solid/i)
expect(out.css).toMatch(/outline-offset:\s*2px/i)
// responsive font size change for h1 in mobile media query
expect(out.css).toMatch(/@media \(max-width: 640px\)[\s\S]*h1\{[^}]*font-size:\s*1\.5rem/i)
})
})