Some checks failed
Forgejo Docker Build / Build Docker image (push) Blocked by required conditions
Forgejo Docker Build / Deploy to the host (push) Blocked by required conditions
Forgejo Android APK / Root app tests (push) Successful in 56s
Forgejo Docker Build / Root app tests (push) Successful in 49s
Forgejo Android APK / Build signed APK (push) Has been cancelled
app.js loads a tab's component once and marks it data-loaded, so the DOM survives leaving and returning. Nothing cleared the result area, and an illustration from a previous generation stayed on screen under a blank form as though it were output for a topic nobody had typed. A full page refresh rebuilt the component and cleared it, which is why it looked like a leak that fixed itself. Cleared at the start of a generation, at the start of a modification, and on re-entering the tab — not on the first visit, where there is nothing to clear. Covers the illustration area, the searches line, the image-failure line and the status text. Also documented what a modification can actually change. The deck vocabulary is structural — bullets, compare, table, callout, figure, image, section, title — and none of those carries a colour; the palette is fixed in render_pptx.py and the model never sees it. So "make it yellow" lands on the only field that takes a colour, image_prompt, and yellow figures appear on an otherwise blue deck. That is not modify reaching only the images; it is the model using the one lever the schema gives it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
39 lines
1.9 KiB
JavaScript
39 lines
1.9 KiB
JavaScript
// The tab keeps its DOM between visits (app.js loads a component once and marks
|
|
// it data-loaded), so whatever the last run rendered stays on screen. An
|
|
// illustration from a previous generation sat under an empty form as though it
|
|
// were output for a topic nobody had typed, and only a full page refresh
|
|
// cleared it.
|
|
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const ui = fs.readFileSync(path.join(__dirname, '..', 'public/js/myResources.js'), 'utf8');
|
|
|
|
test('a new generation starts from a clean result area', () => {
|
|
assert.match(ui, /function clearResults\(\)/);
|
|
const gen = ui.slice(ui.indexOf('function runGenerate'), ui.indexOf('function reportSearches'));
|
|
assert.match(gen, /clearResults\(\);/, 'generate clears before it runs');
|
|
});
|
|
|
|
test('a modification clears it too', () => {
|
|
const start = ui.indexOf('function runModify');
|
|
const mod = ui.slice(start, ui.indexOf('function renderRow', start));
|
|
assert.match(mod, /clearResults\(\);/);
|
|
});
|
|
|
|
test('reopening the tab clears it, but the first visit does not need to', () => {
|
|
const tab = ui.slice(ui.indexOf("e.detail.tab !== 'myresources'"), ui.indexOf('var available'));
|
|
assert.match(tab, /else clearResults\(\);/,
|
|
'only on a revisit — on the first visit there is nothing to clear and init() has not run');
|
|
});
|
|
|
|
test('clearing covers every container a run writes into', () => {
|
|
const fn = ui.slice(ui.indexOf('function clearResults'), ui.indexOf('function runGenerate'));
|
|
for (const id of ['mr-images', 'mr-searches', 'mr-image-failures']) {
|
|
assert.ok(fn.includes(id), id + ' is not cleared');
|
|
}
|
|
assert.match(fn, /status\(''\)/, 'the status line is part of the debris');
|
|
// textContent, not innerHTML: these hold model-derived text and image nodes.
|
|
assert.match(fn, /el\.textContent = ''/);
|
|
});
|