okami.mom/strata

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

Niko1221Merge f-split-int (c157ea373) into f-split-qa1: my new strings renumbered after s3236 (s3237-s3255)e5476b0e1

main
1.6 KiB23 linesraw
1// QA report F03: a dialog opened from the narrow-window menu closes the menu and takes the keyboard.
2// (The real behaviour is checked in a browser by scripts/qa2-flows.mjs; these keep the pieces from being taken out again.)
3import test from 'node:test';
4import assert from 'node:assert/strict';
5import { readFile } from 'node:fs/promises';
6
7const read = path => readFile(new URL(path, import.meta.url), 'utf8').then(s => s.replace(/\r\n/g, '\n'));
8
9test('every dialog the menu opens closes the menu first, and the task dialogs stay mounted while it is closed', async () => {
10  const tree = await read('../src/app/TaskTree.tsx');
11  assert.match(tree, /import \{ pushToast, setNavOpen \} from '\.\.\/lib\/store'/);
12  for (const opener of ['setEditor(blankTask())', 'setEditor({ ...t })', 'setRemove(t)']) assert.ok(tree.includes(`setNavOpen(false); ${opener}`), `${opener} closes the menu`);
13  assert.match(tree, /if \(collapsed\)\n\s+return dialogs;/, 'a closed menu still renders the dialogs');
14  const side = await read('../src/app/Sidebar.tsx');
15  for (const opener of ['setRenameId(menuId)', 'setDeleteId(menuId)', 'setRecentOpen(true)', 'setRemoveWorkspaceId(w.id)', 'setRenameWsId(w.id)', 'setQuitOpen(true)']) assert.ok(side.includes(`setNavOpen(false); ${opener}`), `${opener} closes the menu`);
16});
17
18test('a surface that opens moves the keyboard in even when animation frames are held back', async () => {
19  const focus = await read('../src/lib/focus.ts');
20  assert.match(focus, /const fallback = setTimeout\(/);
21  assert.match(focus, /clearTimeout\(fallback\)/);
22  assert.match(focus, /!el\.contains\(document\.activeElement\) && isTopSurface\(el\)/);
23});