/** GUI feedback round 2 (11-02), items 1 to 8: the owner's own words are in C:\Users\AI-Server\Desktop\gui-feedback2.md. */ import test from 'node:test'; import assert from 'node:assert/strict'; import { readFileSync as read } from 'node:fs'; import { openingVision, shownVision, steadyNoReader } from '../src/lib/pictures-choice.ts'; import { build } from 'esbuild'; import { fileURLToPath } from 'node:url'; const src = name => read(new URL(`../${name}`, import.meta.url), 'utf8'); async function bundle(file) { const result = await build({ entryPoints: [fileURLToPath(new URL(`../src/lib/${file}`, import.meta.url))], bundle: true, format: 'esm', platform: 'node', write: false, loader: { '.json': 'json' } }); return import(`data:text/javascript;base64,${Buffer.from(result.outputFiles[0].text).toString('base64')}`); } globalThis.window ??= globalThis; globalThis.localStorage ??= { getItem: () => null, setItem: () => {} }; const { COMPACT_FILES_FROM, deliveryFolder, dirOf, rootOf } = await bundle('deliverables.ts'); const LANGS = ['en', 'zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko', 'fr']; test('1: Read pictures is a plain checkmark: no explanation, no download button; Load does the rest', () => { const models = src('src/components/NativeModels.tsx'); assert.match(models, /\{tr\("Read pictures"\)\}<\/strong>/); for (const gone of ['Understand photos, screenshots and charts', 'Turn it off to save memory', 'On by default', 'Download picture-reading files', 'Picture reading needs a few more files']) assert.ok(!models.includes(gone), `${gone} is gone from the page`); assert.doesNotMatch(models, /native-vision-missing/); // a failed or offline picture download is still said, in one line under the checkbox, once the model is loaded without them assert.match(models, /vision !== 'no' && !noReader && !active && loadedSelected\?\.picturesNote \?

/); // Load still takes the picture step itself (the host side is pinned in load-pictures.test.mjs) assert.match(models, /picturesByLoad/); }); test('2: the tick of a checkbox is white in light mode and keeps the dark ink in dark mode', () => { const css = src('src/styles/liquid.css'); assert.match(css, /:root \{ --st-check-ink: #ffffff; \}/); assert.match(css, /\[data-theme='dark'\] \{ --st-check-ink: var\(--st-accent-ink\); \}/); assert.match(css, /input\[type='checkbox'\]:checked::after,\s*\.native-image-reading input\[type='checkbox'\]::after,\s*\.native-gpu-options input\[type='checkbox'\]::after \{\s*border-color: var\(--st-check-ink\);/); }); test('3: the progress card names the step and nothing else', () => { const models = src('src/components/NativeModels.tsx'), css = src('src/styles/app.css'); const card = models.slice(models.indexOf('export function NativeProgress')); for (const gone of ['The buttons below wait until this finishes.', 'Still working for {0}', 'native-wait-note', 'section-toolbar']) assert.ok(!models.includes(gone) || !card.includes(gone), gone); assert.ok(!models.includes('The buttons below wait until this finishes.')); assert.match(models, /