30 lines
1.1 KiB
TypeScript
30 lines
1.1 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: 'A11y Tokens',
|
|
locale: 'en',
|
|
theme: { primaryColor: '#0ea5e9', fontFamily: 'Inter' },
|
|
sections: [],
|
|
form: { actionUrl: '', fields: [], spamProtection: { honeypotFieldName: '_hp', minSubmitSeconds: 2 } },
|
|
seo: { title: 'SEO', description: 'Desc' },
|
|
analytics: { ga4MeasurementId: '', metaPixelId: '', customHeadHtml: '' },
|
|
})
|
|
|
|
describe('A11y color/typography token smoke', () => {
|
|
test('base text color, font-family and mobile h1 size markers exist', () => {
|
|
const { css } = exportPage(makePage())
|
|
|
|
// base text color token presence
|
|
expect(css.replace(/\s+/g, ' ')).toMatch(/body\{[^}]*color:\s*#0f172a/i)
|
|
|
|
// font-family token (contains "Inter" and common fallbacks)
|
|
expect(css).toMatch(/body\{[^}]*font-family:\s*Inter/i)
|
|
|
|
// mobile h1 size within max-width:640px media query
|
|
expect(css).toMatch(/@media \(max-width: 640px\)[\s\S]*h1\{[^}]*font-size:\s*1\.5rem/i)
|
|
})
|
|
})
|