Skip to content

Commit 9ae945f

Browse files
author
DavidQ
committed
Restore accordion behavior for Status control in Preview Generator V2 - PR_26126_046-preview-generator-v2-status-accordion-restore
1 parent e811b93 commit 9ae945f

5 files changed

Lines changed: 66 additions & 10 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
PR_26126_046 Preview Generator V2 Status accordion restore
2+
3+
Scope
4+
- Updated Preview Generator V2 Status control only.
5+
- Updated tools/preview-generator-v2/index.html.
6+
- Updated tools/preview-generator-v2/controls/StatusLogControl.js.
7+
- Updated tools/preview-generator-v2/previewGeneratorV2.css for Status accordion layout/hidden state.
8+
- Extended tests/playwright/PreviewGeneratorV2Baseline.spec.mjs to include Status accordion coverage.
9+
- No samples, schemas, or start_of_day files were modified.
10+
11+
Implementation
12+
- Converted #statusAccordion to an accordion-v2 section.
13+
- Added a Status accordion toggle button with aria-controls="statusAccordionContent".
14+
- Kept Clear as a separate button on the same header row, outside the toggle button.
15+
- Wired StatusLogControl to use AccordionSection with #statusAccordionContent.
16+
- Added a scoped hidden-content rule so the log textarea/content hides when Status is collapsed.
17+
18+
Behavior preserved
19+
- Status logging still writes through the existing logger/status control path.
20+
- Clear still clears the logging/status textarea.
21+
- Status remains expanded by default.
22+
- No generation logic changed.
23+
- Other controls were not modified.
24+
25+
Validation
26+
- JavaScript syntax check passed for tools/preview-generator-v2/*.js.
27+
- JavaScript syntax check passed for tools/preview-generator-v2/controls/*.js.
28+
- JavaScript syntax check passed for tests/playwright/PreviewGeneratorV2Baseline.spec.mjs.
29+
- npm run test:workspace-v2 passed.
30+
- Result: 3 passed.
31+
- Confirmed no samples, schemas, or start_of_day changes.
32+
33+
Playwright coverage
34+
- Existing accordion helper now verifies icon state for closed/open.
35+
- Status accordion is included in the accordion coverage list.
36+
- Test verifies #statusAccordionContent hides/shows through the shared accordion behavior.
37+
- Test verifies #clearLogBtn remains visible after accordion toggling.
38+
39+
Full samples smoke test
40+
- Skipped intentionally.
41+
- Reason: this PR is a targeted Preview Generator V2 Status control change and does not modify sample JSON, sample launch code, or shared sample runtime behavior.
42+
43+
Manual validation
44+
- Open tools/preview-generator-v2/index.html.
45+
- Collapse Status and confirm the log textarea hides.
46+
- Expand Status and confirm the log textarea returns.
47+
- Confirm the icon rotates/updates with open/closed state.
48+
- Click Clear and confirm the log output clears.

tests/playwright/PreviewGeneratorV2Baseline.spec.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,12 @@ test.describe("Preview Generator V2 baseline", () => {
317317
"assetFolderContent",
318318
"captureModeContent",
319319
"renderControlsContent",
320-
"outputSummaryContent"
320+
"outputSummaryContent",
321+
"statusAccordionContent"
321322
]) {
322323
await expectAccordionToggles(page, contentId);
323324
}
325+
await expect(page.locator("#clearLogBtn")).toBeVisible();
324326

325327
expect(pageErrors).toEqual([]);
326328
} finally {

tools/preview-generator-v2/controls/StatusLogControl.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import { AccordionSection } from "./AccordionSection.js";
2+
13
class StatusLogControl {
24
constructor({ documentRef = document } = {}) {
5+
this.accordion = new AccordionSection({ content: documentRef.getElementById("statusAccordionContent") });
36
this.statusEl = documentRef.getElementById("status");
47
this.logEl = documentRef.getElementById("log");
58
this.clearLogBtn = documentRef.getElementById("clearLogBtn");

tools/preview-generator-v2/index.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,15 @@ <h2 class="tools-platform-frame__eyebrow">First-Class Tools Surface</h2>
211211
</div>
212212
</section>
213213

214-
<section id="statusAccordion" class="preview-generator-v2__status-block">
214+
<section id="statusAccordion" class="accordion-v2 preview-generator-v2__status-block is-open" data-accordion-v2-open="true">
215215
<div class="preview-generator-v2__status-header-row">
216-
<h2 class="preview-generator-v2__status-heading">Status</h2>
216+
<button class="accordion-v2__header preview-generator-v2__status-accordion-header" type="button" aria-expanded="true" aria-controls="statusAccordionContent">
217+
<span>Status</span>
218+
<span class="accordion-v2__icon" aria-hidden="true">+</span>
219+
</button>
217220
<button id="clearLogBtn" class="preview-generator-v2__status-clear-button" type="button">Clear</button>
218221
</div>
219-
<div id="statusAccordionContent" class="preview-generator-v2__status-content">
222+
<div id="statusAccordionContent" class="accordion-v2__content preview-generator-v2__status-content">
220223
<div id="status" class="preview-generator-v2__status-text" hidden></div>
221224
<div id="log">Ready.
222225
</div>

tools/preview-generator-v2/previewGeneratorV2.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,28 +218,28 @@ body.tools-platform-tool-page[data-tool-id="preview-generator-v2"] > .palette-ma
218218
padding: 8px;
219219
}
220220

221+
.preview-generator-v2__status-content[hidden] {
222+
display: none;
223+
}
224+
221225
.preview-generator-v2__status-header-row {
222226
flex: 0 0 auto;
223227
display: flex;
224228
align-items: center;
225229
justify-content: space-between;
226230
gap: 8px;
227231
min-width: 0;
228-
padding: 8px 10px;
229232
border-bottom: 1px solid var(--pm-line, rgba(221, 214, 254, 0.26));
230233
}
231234

232-
.preview-generator-v2__status-heading {
235+
.preview-generator-v2__status-accordion-header {
233236
flex: 1 1 auto;
234237
min-width: 0;
235-
margin: 0;
236-
color: var(--pm-text, #f7f4ff);
237-
font-size: 0.95rem;
238-
font-weight: 700;
239238
}
240239

241240
.preview-generator-v2__status-clear-button {
242241
flex: 0 0 auto;
242+
margin-right: 10px;
243243
}
244244

245245
.preview-generator-v2__status-text {

0 commit comments

Comments
 (0)