Files
technitium-console/dev/theme-contrast.test.mjs
T
DenozordecandClaude Sonnet 5.5 f3531c64f9 Move the console onto ReUI PRO
Install ReUI (MCP, skill, @reui registry, Tailwind v4, shadcn base-nova) and move
the shared UI onto it: Button, Tag, Check, Input/Textarea, Segmented, Alert, Panel,
Dialog, Tooltip, Menu and Select (Popover), Toast (sonner), the Table frame
(DataGrid), the Dashboard KPI strip, the shnt Ops palette, Geist and the type scale.

Design only: behaviour, texts and roles are unchanged. Tests that asserted the old
DOM were updated; the tests now format numbers in English wherever they run.
docs/reui-migration-plan.md records the plan and its decisions.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-27 00:06:06 +07:00

34 lines
1.5 KiB
JavaScript

import { readFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { themeTokens } from './check-colour-tokens.mjs'
import { codePalettes, regressions, thinSeries, uiClashes } from './palette-distance.mjs'
import { measure } from './theme-contrast.mjs'
/*
The light theme's two measurements, inside `npm test`: a value tuned by hand in
`tokens.css` that breaks a pair breaks the suite, not only the script nobody ran.
Dark is measured by the same scripts and not gated here; see their headers.
*/
const here = dirname(fileURLToPath(import.meta.url))
const themes = themeTokens(readFileSync(resolve(here, '../src/theme/tokens.css'), 'utf8'))
describe('the light theme, measured', () => {
it('every text and control colour meets its threshold on every surface it is drawn on', () => {
const under = measure(themes.light).filter((r) => !r.pass).map((r) => `--${r.fg} on ${r.on}: ${r.ratio.toFixed(2)}`)
expect(under).toEqual([])
})
it('every chart series holds 3:1 on the panel and is not the colour of the interface', () => {
const { light } = codePalettes()
expect(thinSeries(light, light.pan)).toEqual([])
expect(uiClashes(light, { ink: light.ink, mute: light.mute, faint: light.faint, line: light.line })).toEqual([])
})
it('no pair of series separates less in light than in dark, unless both are past 15', () => {
const { dark, light } = codePalettes()
expect(regressions(dark, light)).toEqual([])
})
})