Skip to content

Commit 5e91a54

Browse files
author
DavidQ
committed
Restore working right-column accordion and move Ready status into output area - PR_26126_018-preview-generator-v2-working-accordion-and-status-fix
1 parent 4800cf0 commit 5e91a54

5 files changed

Lines changed: 385 additions & 267 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Codex Commands - PR_26126_015-preview-generator-v2-output-target-polish
1+
# Codex Commands - PR_26126_018-preview-generator-v2-working-accordion-and-status-fix
22

33
```bash
4-
codex run "Create PR_26126_015-preview-generator-v2-output-target-polish. Fix Preview Generator V2 UI polish only. Preserve existing generation behavior. Output Summary must not show dead accordion controls such as X or underscore unless they work; remove those controls. Status must remain a normal block with no accordion and no X. Update write folder sample labels/values: \"games\\Game Name\" becomes \"games\\<gamename>\", \"tools\\Tool Name\" becomes \"tools\\<toolname>\", and any repeated game example must use \"games\\<gamename>\". In Target type, move Games above Samples and remove the \"Target type\" text label. Render \"Write folder sample\" label/value on two lines with value \"samples\\phaseXX\\XXXX\\assets\\images\". Render \"Write folder\" label/value on two lines with value \"not available yet\". Do not modify samples. Do not add schema. Produce review artifacts."
4+
codex run "Create PR_26126_018-preview-generator-v2-working-accordion-and-status-fix. Fix Preview Generator V2 UI only. Preserve existing generation behavior. Right column controls must use a working accordion: headers toggle open/closed panels, icons reflect state, and controls remain usable when expanded. Do not leave dead X/underscore controls. Move status text such as \"Ready.\" out of the header/status line and into the textarea/status output area below. Specifically, do not set header/status display to \"Ready.\"; keep repo destination display separate from status output. Ensure setRepoDestinationDisplayName(repoDisplayName) still works, execute button enables correctly, and \"Ready.\" appears only in the lower text/status output area. Do not modify samples. Do not add schema. Produce review artifacts."
55
```
66

77
## Validation Commands
@@ -39,7 +39,7 @@ await page.addInitScript(() => {
3939
async createWritable() { const path = this.path; return { async write(content) { writes.push({ path, content: String(content) }); }, async close() {} }; }
4040
}
4141
class FakeDirectoryHandle {
42-
constructor(name = 'SelectedRepoFolder', path = '') { this.kind = 'directory'; this.name = name; this.path = path; this.children = new Map(); }
42+
constructor(name = 'HTML-JavaScript-Gaming', path = '') { this.kind = 'directory'; this.name = name; this.path = path; this.children = new Map(); }
4343
async getDirectoryHandle(name) { const key = `dir:${name}`; if (!this.children.has(key)) { const nextPath = this.path ? `${this.path}/${name}` : name; this.children.set(key, new FakeDirectoryHandle(name, nextPath)); } return this.children.get(key); }
4444
async getFileHandle(name, options = {}) { const key = `file:${name}`; if (!this.children.has(key)) { if (!options.create) throw new DOMException('Not found', 'NotFoundError'); const nextPath = this.path ? `${this.path}/${name}` : name; this.children.set(key, new FakeFileHandle(nextPath)); } return this.children.get(key); }
4545
}
@@ -49,46 +49,47 @@ await page.addInitScript(() => {
4949
5050
await page.goto(`${server.baseUrl}/tools/preview-generator-v2/index.html`, { waitUntil: 'domcontentloaded' });
5151
await page.waitForSelector('#shared-theme-header');
52-
53-
if (await page.locator('#outputSummary .accordion-v2__icon').count() !== 0) throw new Error('Output Summary still has accordion icon controls.');
54-
if (await page.locator('#outputSummary .accordion-v2__header').count() !== 0) throw new Error('Output Summary still has accordion header controls.');
55-
if (await page.locator('#statusAccordionContent').count() !== 0) throw new Error('Status accordion content still exists.');
56-
if (await page.locator('.preview-generator-v2__status-block .accordion-v2__icon').count() !== 0) throw new Error('Status block still has accordion icon controls.');
57-
58-
const targetLabels = await page.locator('#targetSourceAccordionContent .preview-generator-v2__radio-option span').evaluateAll((items) => items.map((item) => item.textContent.trim()));
59-
if (JSON.stringify(targetLabels) !== JSON.stringify(['Games', 'Samples', 'Tools'])) throw new Error(`Unexpected target order: ${JSON.stringify(targetLabels)}`);
60-
if ((await page.locator('#targetSourceAccordionContent').innerText()).includes('Target type')) throw new Error('Target type text label still visible.');
61-
62-
const initialSampleText = await page.locator('#writeFolderSampleValue').innerText();
63-
if (initialSampleText !== 'samples\\phaseXX\\XXXX\\assets\\images') throw new Error(`Unexpected initial sample text: ${initialSampleText}`);
64-
const initialWriteText = await page.locator('#writeFolderActualValue').innerText();
65-
if (initialWriteText !== 'not available yet') throw new Error(`Unexpected initial write folder text: ${initialWriteText}`);
66-
67-
const summaryFields = await page.locator('#outputSummaryContent .preview-generator-v2__summary-field').evaluateAll((fields) => fields.map((field) => {
68-
const children = Array.from(field.children);
69-
return children.map((child) => ({ text: child.textContent.trim(), top: Math.round(child.getBoundingClientRect().top) }));
70-
}));
71-
for (const field of summaryFields) {
72-
if (field.length !== 2 || field[0].top >= field[1].top) throw new Error(`Summary field is not two-line label/value: ${JSON.stringify(field)}`);
52+
await page.waitForFunction(() => document.querySelector('#outputSummary .accordion-v2__header')?.dataset.accordionV2Bound === 'true');
53+
await page.waitForFunction(() => document.querySelector('#statusAccordion .accordion-v2__header')?.dataset.accordionV2Bound === 'true');
54+
55+
for (const selector of ['#outputSummary', '#statusAccordion']) {
56+
const header = page.locator(`${selector} .accordion-v2__header`);
57+
const content = page.locator(`${selector} .accordion-v2__content`);
58+
const icon = page.locator(`${selector} .accordion-v2__icon`);
59+
if (await header.count() !== 1) throw new Error(`${selector} missing accordion header`);
60+
if (await content.count() !== 1) throw new Error(`${selector} missing accordion content`);
61+
if (await icon.count() !== 1) throw new Error(`${selector} missing accordion icon`);
62+
if (await header.getAttribute('aria-expanded') !== 'true') throw new Error(`${selector} should start expanded`);
63+
await header.click();
64+
await page.waitForFunction((target) => document.querySelector(`${target} .accordion-v2__header`)?.getAttribute('aria-expanded') === 'false', selector);
65+
const collapsed = await content.evaluate((node) => ({
66+
hidden: node.hidden,
67+
display: getComputedStyle(node).display,
68+
height: node.getBoundingClientRect().height
69+
}));
70+
if (!collapsed.hidden) throw new Error(`${selector} content should be hidden after collapse`);
71+
if (collapsed.display !== 'none') throw new Error(`${selector} collapsed content display should be none, got ${collapsed.display}`);
72+
if (collapsed.height !== 0) throw new Error(`${selector} collapsed content height should be 0, got ${collapsed.height}`);
73+
await header.click();
74+
await page.waitForFunction((target) => document.querySelector(`${target} .accordion-v2__header`)?.getAttribute('aria-expanded') === 'true', selector);
75+
if (await content.evaluate((node) => node.hidden) !== false) throw new Error(`${selector} content should be visible after expand`);
7376
}
7477
75-
const placeholder = await page.locator('#sampleList').getAttribute('placeholder');
76-
if (!placeholder.includes('games\\<gamename>\\index.html')) throw new Error(`Game placeholder not normalized: ${placeholder}`);
77-
if (!placeholder.includes('tools\\<toolname>\\index.html')) throw new Error(`Tool placeholder not normalized: ${placeholder}`);
78-
79-
await page.check('#targetTypeGames');
80-
await page.waitForFunction(() => document.getElementById('writeFolderSampleValue').textContent === 'games\\<gamename>\\assets\\images');
81-
await page.check('#targetTypeTools');
82-
await page.waitForFunction(() => document.getElementById('writeFolderSampleValue').textContent === 'tools\\<toolname>\\assets\\images');
83-
await page.check('#targetTypeSamples');
84-
await page.waitForFunction(() => document.getElementById('writeFolderSampleValue').textContent === 'samples\\phaseXX\\XXXX\\assets\\images');
78+
if (await page.locator('#status').isVisible()) throw new Error('Hidden status display should not be visible.');
79+
const initialLog = await page.locator('#log').innerText();
80+
if (!initialLog.trim().startsWith('Ready.')) throw new Error(`Ready should be in lower log output: ${initialLog}`);
81+
if ((await page.locator('#status').textContent()).includes('Ready.')) throw new Error('Ready should not be set on hidden status display.');
82+
if ((await page.locator('#statusAccordion .accordion-v2__header').innerText()).includes('Ready.')) throw new Error('Ready should not be in Status header.');
8583
8684
await page.fill('#baseUrl', server.baseUrl);
8785
await page.fill('#waitMs', '3000');
8886
await page.fill('#sampleList', '0107');
8987
await page.check('#forceRewrite');
9088
await page.click('#pickRepoBtn');
9189
await page.waitForFunction(() => !document.getElementById('executeBtn').disabled);
90+
const repoSelected = await page.locator('#repoSelectedValue').innerText();
91+
if (repoSelected !== 'HTML-JavaScript-Gaming') throw new Error(`Repo selected did not populate from folder handle: ${repoSelected}`);
92+
if ((await page.locator('#status').textContent()).includes('Ready.')) throw new Error('Repo selection should not set Ready on status display.');
9293
await page.waitForFunction(() => document.getElementById('writeFolderActualValue').textContent === 'samples\\phase-01\\0107\\assets\\images');
9394
await page.click('#executeBtn');
9495
await page.waitForFunction(() => document.getElementById('log').textContent.includes('===== SUMMARY ====='), null, { timeout: 35000 });
@@ -99,14 +100,14 @@ if (!writes[0].content.includes('<svg')) throw new Error('Generated content is n
99100
if (errors.length || consoleErrors.length) throw new Error([...errors, ...consoleErrors].join(' | '));
100101
await browser.close();
101102
await server.close();
102-
console.log('preview-generator-v2 output target polish browser smoke valid');
103+
console.log('preview-generator-v2 working accordion and status browser smoke valid');
103104
'@ | node --input-type=module -
104105
```
105106

106107
## Notes
107108

108-
The targeted Playwright smoke validates that Output Summary and Status have no dead accordion controls, target radios display Games/Samples/Tools, placeholder and write-folder sample text uses `<gamename>`/`<toolname>`, summary fields render as label/value rows, and the existing preview generation path still writes `preview.svg`.
109+
The targeted Playwright smoke validates that Output Summary and Status are working accordionV2 panels, their headers toggle `aria-expanded`, collapsed panels compute to `display: none` with zero content height, `Ready.` appears only in the lower log output, repo destination display still updates, Generate Preview enables, and the existing preview generation path still writes `preview.svg`.
109110

110111
`npm run test:workspace-v2` was attempted, but the script is not defined in this checkout.
111112

112-
Full samples smoke test was skipped because this PR is scoped to Preview Generator V2 UI polish only.
113+
Full samples smoke test was skipped because this PR is scoped to Preview Generator V2 UI only.

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Polish Preview Generator V2 output targets and summary controls - PR_26126_015-preview-generator-v2-output-target-polish
1+
Fix Preview Generator V2 right accordion collapse behavior - PR_26126_018-preview-generator-v2-working-accordion-and-status-fix
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# git status --short
2-
M docs/dev/codex_commands.md
3-
M docs/dev/commit_comment.txt
4-
M tools/preview-generator-v2/index.html
2+
M docs/dev/codex_commands.md
3+
M docs/dev/commit_comment.txt
4+
M docs/dev/reports/codex_changed_files.txt
5+
M docs/dev/reports/codex_review.diff
6+
M tools/preview-generator-v2/index.html
57

68
# git diff --stat
7-
docs/dev/codex_commands.md | 56 +++++++++++++++++------------
8-
docs/dev/commit_comment.txt | 2 +-
9-
tools/preview-generator-v2/index.html | 66 ++++++++++++++++-------------------
10-
3 files changed, 66 insertions(+), 58 deletions(-)
9+
docs/dev/codex_commands.md | 75 +++++++++++-----------
10+
docs/dev/commit_comment.txt | 2 +-
11+
tools/preview-generator-v2/index.html | 116 ++++++++++++++++++++--------------
12+
3 files changed, 109 insertions(+), 84 deletions(-)

0 commit comments

Comments
 (0)