okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
4fb068a8c
main
1import test from 'node:test' ; 2import assert from 'node:assert/strict' ; 3import { readFileSync } from 'node:fs' ; 4import { resolve } from 'node:path' ; 5 6const root = resolve ( import . meta. dirname , '..' ); 7const read = ( p ) => readFileSync ( resolve ( root , p ), 'utf8' ); 8const liquid = read ( 'src/styles/liquid.css' ); 9 10test ( 'every screen header title uses the chat title step, from one rule' , () => { 11const rule = liquid . match ( / \.chat-toolbar__conversation h1,\s * \.main__head \.main__title \{ ([ ^ } ] * ) \} / ); 12assert . ok ( rule , 'the chat title and the screen titles share one rule' ); 13assert . match ( rule [ 1 ], / font-size:\s * var\(--st-fs-md\) / ); 14assert . match ( liquid , / \.main__head \.main__title \{ font-weight: 600; \} / ); 15const imports = [ ...read ( 'src/main.tsx' ). matchAll ( / import '\.\/styles\/ ([ ^ ' ] + ) ' / g )]. map ( m => m [ 1 ]); 16assert . equal ( imports . at ( - 1 ), 'liquid.css' , 'liquid.css loads last, so no sheet after it can resize a title' ); 17}); 18 19test ( 'the chat title and the screen titles are the same size' , () => { 20const app = read ( 'src/styles/app.css' ); 21const chat = app . match ( / \.chat-toolbar__conversation h1 \{ [ ^ } ] * font-size:\s * var\(--st-fs-sm\) / ); 22assert . ok ( chat , 'app.css still sets the chat title; liquid.css raises it to --st-fs-md for chat and screens together' ); 23}); 24 25test ( 'the Tasks header has no subtitle under it' , () => { 26const tasks = read ( 'src/screens/Tasks.tsx' ); 27assert . ok ( ! /Everything that is running, waiting for you / . test ( tasks )); 28assert . ok ( ! /<Screen [ ^ \n ] * \bsub= / . test ( tasks )); 29});