okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221rc1 merge ds-coder (d6a5a7837)4fb068a8c

main
1.5 KiB29 linesraw
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', () => {
11  const rule = liquid.match(/\.chat-toolbar__conversation h1,\s*\.main__head \.main__title \{([^}]*)\}/);
12  assert.ok(rule, 'the chat title and the screen titles share one rule');
13  assert.match(rule[1], /font-size:\s*var\(--st-fs-md\)/);
14  assert.match(liquid, /\.main__head \.main__title \{ font-weight: 600; \}/);
15  const imports = [...read('src/main.tsx').matchAll(/import '\.\/styles\/([^']+)'/g)].map(m => m[1]);
16  assert.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', () => {
20  const app = read('src/styles/app.css');
21  const chat = app.match(/\.chat-toolbar__conversation h1 \{[^}]*font-size:\s*var\(--st-fs-sm\)/);
22  assert.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', () => {
26  const tasks = read('src/screens/Tasks.tsx');
27  assert.ok(!/Everything that is running, waiting for you/.test(tasks));
28  assert.ok(!/<Screen[^\n]*\bsub=/.test(tasks));
29});