Skip to content

Commit 5882882

Browse files
author
DavidQ
committed
Move Clear button into Status accordion header without changing behavior - PR_26126_072-status-clear-header-placement-fix
1 parent 6f2042a commit 5882882

6 files changed

Lines changed: 61 additions & 24 deletions

File tree

docs/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ Note: entry percentages use function coverage when available, otherwise line cov
1111
Note: coverage entries are aggregated across every page/tool where coverageReporter.start(page) and coverageReporter.stop(page) ran.
1212

1313
Exercised tool entry points detected:
14-
(86%) Preview Generator V2 - exercised 19 runtime JS files
14+
(87%) Preview Generator V2 - exercised 19 runtime JS files
1515
(49%) Palette Manager - exercised 12 runtime JS files
1616
(84%) Tool Template V2 - exercised 10 runtime JS files
1717
(0%) Workspace V2 - not exercised by this Playwright run
1818
(0%) Workspace Manager - not exercised by this Playwright run
1919

2020
Changed runtime JS files covered:
21-
(100%) none changed - no changed runtime JS files
21+
(100%) tools/preview-generator-v2/controls/StatusLogControl.js - executed lines 22/22; executed functions 6/6
2222

2323
Files with executed line/function counts where available:
2424
(2%) src/engine/input/ActionInputService.js - executed lines 397/397; executed functions 1/51
@@ -104,8 +104,8 @@ Files with executed line/function counts where available:
104104
(82%) samples/shared/sampleDetailPageEnhancement.js - executed lines 471/471; executed functions 41/50
105105
(86%) tools/templates-v2/js/controls/StatusLogControl.js - executed lines 21/21; executed functions 6/7
106106
(87%) tools/common/PaletteSortService.js - executed lines 103/103; executed functions 13/15
107-
(88%) tools/preview-generator-v2/PreviewGeneratorV2App.js - executed lines 539/539; executed functions 51/58
108107
(88%) tools/templates-v2/js/controls/SourceInputControl.js - executed lines 33/33; executed functions 7/8
108+
(90%) tools/preview-generator-v2/PreviewGeneratorV2App.js - executed lines 539/539; executed functions 52/58
109109
(92%) tools/templates-v2/js/controls/ToolStarterShellControl.js - executed lines 111/111; executed functions 11/12
110110
(100%) samples/phase-01/0102/KeyboardMoveScene.js - executed lines 78/78; executed functions 6/6
111111
(100%) samples/phase-01/0102/main.js - executed lines 23/23; executed functions 1/1
@@ -142,7 +142,7 @@ Files with executed line/function counts where available:
142142
(100%) tools/preview-generator-v2/controls/PreviewFrameControl.js - executed lines 9/9; executed functions 3/3
143143
(100%) tools/preview-generator-v2/controls/RenderControlsControl.js - executed lines 18/18; executed functions 5/5
144144
(100%) tools/preview-generator-v2/controls/RepoDestinationControl.js - executed lines 16/16; executed functions 4/4
145-
(100%) tools/preview-generator-v2/controls/StatusLogControl.js - executed lines 19/19; executed functions 5/5
145+
(100%) tools/preview-generator-v2/controls/StatusLogControl.js - executed lines 22/22; executed functions 6/6
146146
(100%) tools/preview-generator-v2/controls/TargetSourceControl.js - executed lines 30/30; executed functions 11/11
147147
(100%) tools/preview-generator-v2/previewGeneratorV2.bootstrap.js - executed lines 4/4; executed functions 1/1
148148
(100%) tools/preview-generator-v2/PreviewGeneratorV2Logger.js - executed lines 19/19; executed functions 5/5
@@ -156,7 +156,8 @@ Files with executed line/function counts where available:
156156
(100%) tools/templates-v2/js/services/ToolStateSerializer.js - executed lines 13/13; executed functions 3/3
157157

158158
Uncovered or low-coverage changed JS files:
159-
(100%) none changed - no changed runtime JS files
159+
(100%) none - no low-coverage changed runtime JS files
160160

161161
Changed JS files considered:
162162
(0%) tests/playwright/PreviewGeneratorV2Baseline.spec.mjs - changed JS file not collected as browser runtime coverage
163+
(100%) tools/preview-generator-v2/controls/StatusLogControl.js - changed JS file with browser V8 coverage
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
PR_26126_072-status-clear-header-placement-fix
2+
3+
Scope:
4+
- Preview Generator V2 Status header placement and Status Clear interaction only.
5+
6+
Changes:
7+
- Moved the Clear button into the actual Status `.accordion-v2__header` DOM node with the Status title and accordion icon.
8+
- Kept Clear on the same visual row as the Status title and accordion toggle.
9+
- Stopped Clear click propagation so Clear does not collapse or expand the Status accordion.
10+
- Added Playwright assertions that:
11+
- Clear is inside the Status accordion header
12+
- Clear empties the status/log output
13+
- Clear does not toggle the accordion when Status is open
14+
- Clear does not toggle the accordion when Status is collapsed
15+
16+
Playwright impacted: Yes
17+
- This PR changes UI control placement and event behavior.
18+
- `npm run test:workspace-v2` must pass.
19+
20+
Validation:
21+
- `node --check tests/playwright/PreviewGeneratorV2Baseline.spec.mjs` passed.
22+
- `node --check tools/preview-generator-v2/controls/StatusLogControl.js` passed.
23+
- `npm run test:workspace-v2` passed: 7 tests passed.
24+
- `git diff --check` passed with line-ending warnings only.
25+
26+
Manual test notes:
27+
- Open Preview Generator V2.
28+
- Confirm Status shows Status, Clear, and the accordion icon on the same header row.
29+
- Click Clear and confirm the log is emptied without changing the Status accordion open/closed state.
30+
- Click the Status header outside Clear and confirm the accordion still collapses and expands.

tests/playwright/PreviewGeneratorV2Baseline.spec.mjs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,15 @@ test.describe("Preview Generator V2 baseline", () => {
383383
await expect(page.locator("#repoSelectedValue")).toHaveText("HTML-JavaScript-Gaming");
384384
await expect(page.locator("#executeBtn")).toBeEnabled();
385385

386+
const statusHeader = page.locator('#statusAccordion .accordion-v2__header[aria-controls="statusAccordionContent"]');
387+
const statusContent = page.locator("#statusAccordionContent");
388+
await expect(statusHeader.locator("#clearLogBtn")).toBeVisible();
389+
await expect(statusHeader).toHaveAttribute("aria-expanded", "true");
390+
await expect(statusContent).toBeVisible();
386391
await page.locator("#clearLogBtn").click();
387392
await expect(page.locator("#log")).toHaveText("");
393+
await expect(statusHeader).toHaveAttribute("aria-expanded", "true");
394+
await expect(statusContent).toBeVisible();
388395

389396
for (const contentId of [
390397
"repoDestinationContent",
@@ -399,7 +406,16 @@ test.describe("Preview Generator V2 baseline", () => {
399406
await expectAccordionToggles(page, contentId);
400407
}
401408
await expect(page.locator("#clearLogBtn")).toBeVisible();
402-
await expect(page.locator("#statusAccordion .preview-generator-v2__status-header-actions #clearLogBtn")).toBeVisible();
409+
await expect(statusHeader.locator(".preview-generator-v2__status-header-actions #clearLogBtn")).toBeVisible();
410+
await page.locator("#captureModeFullScreen").check();
411+
await expect(page.locator("#log")).toContainText("Capture mode: Full Screen");
412+
await statusHeader.click();
413+
await expect(statusContent).toBeHidden();
414+
await expect(statusHeader).toHaveAttribute("aria-expanded", "false");
415+
await page.locator("#clearLogBtn").click();
416+
await expect(page.locator("#log")).toHaveText("");
417+
await expect(statusHeader).toHaveAttribute("aria-expanded", "false");
418+
await expect(statusContent).toBeHidden();
403419

404420
expect(pageErrors).toEqual([]);
405421
} finally {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ class StatusLogControl {
1717
}
1818

1919
onClear(handler) {
20-
this.clearLogBtn.addEventListener("click", handler);
20+
this.clearLogBtn.addEventListener("click", (event) => {
21+
event.stopPropagation();
22+
handler(event);
23+
});
2124
}
2225
}
2326

tools/preview-generator-v2/index.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,11 @@ <h2 class="tools-platform-frame__eyebrow">First-Class Tools Surface</h2>
212212
</section>
213213

214214
<section id="statusAccordion" class="accordion-v2 preview-generator-v2__status-block is-open" data-accordion-v2-open="true">
215-
<div class="preview-generator-v2__status-header-row">
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>
215+
<div class="accordion-v2__header preview-generator-v2__status-accordion-header" aria-expanded="true" aria-controls="statusAccordionContent">
216+
<span>Status</span>
220217
<div class="preview-generator-v2__status-header-actions">
221218
<button id="clearLogBtn" class="preview-generator-v2__status-clear-button" type="button">Clear</button>
219+
<span class="accordion-v2__icon" aria-hidden="true">+</span>
222220
</div>
223221
</div>
224222
<div id="statusAccordionContent" class="accordion-v2__content preview-generator-v2__status-content">

tools/preview-generator-v2/previewGeneratorV2.css

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,8 @@ body.tools-platform-tool-page[data-tool-id="preview-generator-v2"] > .palette-ma
222222
display: none;
223223
}
224224

225-
.preview-generator-v2__status-header-row {
226-
flex: 0 0 auto;
227-
display: flex;
228-
align-items: center;
229-
justify-content: space-between;
230-
gap: 8px;
231-
min-width: 0;
232-
border-bottom: 1px solid var(--pm-line, rgba(221, 214, 254, 0.26));
233-
}
234-
235225
.preview-generator-v2__status-accordion-header {
236-
flex: 1 1 auto;
226+
flex: 0 0 44px;
237227
min-width: 0;
238228
}
239229

@@ -242,7 +232,6 @@ body.tools-platform-tool-page[data-tool-id="preview-generator-v2"] > .palette-ma
242232
display: inline-flex;
243233
align-items: center;
244234
gap: 8px;
245-
padding-right: 10px;
246235
}
247236

248237
.preview-generator-v2__status-clear-button {

0 commit comments

Comments
 (0)