Skip to content

Commit 04ce0e3

Browse files
author
DavidQ
committed
Match Status Clear button styling to Preview Generator V2 header action pattern - PR_26126_074-status-clear-style-match
1 parent 5882882 commit 04ce0e3

7 files changed

Lines changed: 178 additions & 9 deletions

File tree

docs/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Exercised tool entry points detected:
1818
(0%) Workspace Manager - not exercised by this Playwright run
1919

2020
Changed runtime JS files covered:
21-
(100%) tools/preview-generator-v2/controls/StatusLogControl.js - executed lines 22/22; executed functions 6/6
21+
(86%) tools/templates-v2/js/controls/StatusLogControl.js - executed lines 24/24; executed functions 6/7
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
@@ -102,7 +102,7 @@ Files with executed line/function counts where available:
102102
(77%) src/engine/core/Engine.js - executed lines 323/323; executed functions 10/13
103103
(80%) src/engine/theme/accordionV2/accordionV2.js - executed lines 26/26; executed functions 4/5
104104
(82%) samples/shared/sampleDetailPageEnhancement.js - executed lines 471/471; executed functions 41/50
105-
(86%) tools/templates-v2/js/controls/StatusLogControl.js - executed lines 21/21; executed functions 6/7
105+
(86%) tools/templates-v2/js/controls/StatusLogControl.js - executed lines 24/24; executed functions 6/7
106106
(87%) tools/common/PaletteSortService.js - executed lines 103/103; executed functions 13/15
107107
(88%) tools/templates-v2/js/controls/SourceInputControl.js - executed lines 33/33; executed functions 7/8
108108
(90%) tools/preview-generator-v2/PreviewGeneratorV2App.js - executed lines 539/539; executed functions 52/58
@@ -160,4 +160,4 @@ Uncovered or low-coverage changed 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
163+
(86%) tools/templates-v2/js/controls/StatusLogControl.js - changed JS file with browser V8 coverage
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
PR_26126_073-status-clear-placement-match-preview-generator
2+
3+
Scope:
4+
- Tool Template V2 Status Clear placement and behavior.
5+
- Preview Generator V2 was used as the reference pattern.
6+
7+
Preview Generator V2 pattern reviewed:
8+
- `tools/preview-generator-v2/index.html`
9+
- Working Status pattern:
10+
- `section.accordion-v2`
11+
- `.accordion-v2__header` contains the `Status` title
12+
- header action container contains `Clear`
13+
- accordion icon remains in the same header action row
14+
- content contains only the status/log output
15+
16+
Changes:
17+
- Applied the same Status header/action pattern to `tools/templates-v2/index.html`.
18+
- Moved `#clearStatusButton` out of `#statusLogContent` and into the Status `.accordion-v2__header`.
19+
- Added `tool-starter__status-header-actions` and `tool-starter__status-clear-button` styling to keep Clear on the same visual row as the Status title and accordion icon.
20+
- Updated `tools/templates-v2/js/controls/StatusLogControl.js` so Clear stops event propagation before clearing the log.
21+
- Extended workspace Playwright assertions for Tool Template V2 to verify:
22+
- Clear is physically inside the Status header DOM
23+
- Clear is not inside the Status content panel
24+
- Clear aligns on the same header row as the Status title
25+
- Clear clears the textarea while the accordion is open
26+
- Clear clears the textarea without toggling while the accordion is collapsed
27+
- Status still expands and collapses from the normal Status title/header click
28+
29+
Playwright impacted: Yes
30+
- This PR changes Tool Template V2 UI control placement and click behavior.
31+
- `npm run test:workspace-v2` passed.
32+
33+
Validation:
34+
- `node --check tests/playwright/PreviewGeneratorV2Baseline.spec.mjs` passed.
35+
- `node --check tools/templates-v2/js/controls/StatusLogControl.js` passed.
36+
- `npm run test:workspace-v2` passed: 7 tests passed.
37+
- `git diff --check` passed with line-ending warnings only.
38+
39+
Manual test notes:
40+
- Open Tool Template V2.
41+
- Confirm the Status header row shows `Status`, `Clear`, and the accordion icon on the same row.
42+
- Click Clear and confirm the status textarea empties without changing accordion state.
43+
- Click the Status title/header and confirm the Status section still collapses and expands.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
PR_26126_074-status-clear-style-match
2+
3+
Scope:
4+
- Tool Template V2 Status Clear button styling only.
5+
- Existing Status header placement and Clear behavior were preserved.
6+
7+
Preview Generator V2 styling reviewed:
8+
- `tools/preview-generator-v2/index.html`
9+
- `tools/preview-generator-v2/previewGeneratorV2.css`
10+
- Preview Generator V2 keeps Clear in the Status header action row with:
11+
- `preview-generator-v2__status-header-actions`
12+
- `preview-generator-v2__status-clear-button`
13+
- compact browser-style button padding
14+
- 10px rounded border inherited from the Palette Manager surface button pattern
15+
16+
Changes:
17+
- Updated `tools/templates-v2/styles/toolStarter.css` so `#clearStatusButton` visually follows the Preview Generator V2 header action button pattern:
18+
- compact `2px 6px` padding
19+
- 10px border radius
20+
- same status header action spacing
21+
- browser-style ButtonFace/ButtonText colors instead of the dark template action-button treatment
22+
- unchanged hover styling pattern
23+
- Added Playwright style assertions for Tool Template V2 Status Clear:
24+
- Clear remains inside the Status header
25+
- Clear remains on the Status header row
26+
- Clear uses the compact Preview-style border radius and padding
27+
- Clear still clears the textarea
28+
- Clear still does not toggle the accordion
29+
30+
Playwright impacted: Yes
31+
- This PR changes a visible UI control style and validates the existing Status Clear behavior.
32+
- `npm run test:workspace-v2` passed.
33+
34+
Validation:
35+
- `node --check tests/playwright/PreviewGeneratorV2Baseline.spec.mjs` passed.
36+
- `node --check tools/templates-v2/js/controls/StatusLogControl.js` passed.
37+
- `npm run test:workspace-v2` passed: 7 tests passed.
38+
- `git diff --check` passed.
39+
40+
Manual test notes:
41+
- Open Tool Template V2.
42+
- Confirm the Status Clear button remains in the Status header row.
43+
- Confirm Clear visually matches the Preview Generator V2 compact header action button style.
44+
- Click Clear and confirm the status textarea empties without collapsing or expanding Status.

tests/playwright/PreviewGeneratorV2Baseline.spec.mjs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,38 @@ test.describe("Preview Generator V2 baseline", () => {
591591
await expect(page.locator(".tool-starter__panel--right #inspectorContent")).toBeVisible();
592592
await expect(page.locator(".tool-starter__panel--right #statusLogContent")).toBeVisible();
593593
await expect(page.locator(".tool-starter__panel--right .accordion-v2").last()).toContainText("Status");
594+
const templateStatusHeader = page.locator('.tool-starter__panel--right .accordion-v2__header[aria-controls="statusLogContent"]');
595+
const templateStatusContent = page.locator("#statusLogContent");
596+
const templateStatusTitle = templateStatusHeader.locator("span").first();
597+
await expect(templateStatusHeader.locator("#clearStatusButton")).toBeVisible();
598+
await expect(templateStatusContent.locator("#clearStatusButton")).toHaveCount(0);
599+
const clearAlignment = await page.evaluate(() => {
600+
const header = document.querySelector('.tool-starter__panel--right .accordion-v2__header[aria-controls="statusLogContent"]');
601+
const clear = document.getElementById("clearStatusButton");
602+
const headerRect = header.getBoundingClientRect();
603+
const clearRect = clear.getBoundingClientRect();
604+
return {
605+
clearInsideHeader: header.contains(clear),
606+
headerCenterY: headerRect.top + headerRect.height / 2,
607+
clearCenterY: clearRect.top + clearRect.height / 2,
608+
headerHeight: headerRect.height
609+
};
610+
});
611+
expect(clearAlignment.clearInsideHeader).toBe(true);
612+
expect(Math.abs(clearAlignment.clearCenterY - clearAlignment.headerCenterY)).toBeLessThan(clearAlignment.headerHeight / 2);
613+
const clearStyle = await page.locator("#clearStatusButton").evaluate((button) => {
614+
const style = getComputedStyle(button);
615+
return {
616+
borderRadius: style.borderRadius,
617+
paddingLeft: style.paddingLeft,
618+
paddingRight: style.paddingRight,
619+
cursor: style.cursor
620+
};
621+
});
622+
expect(clearStyle.borderRadius).toBe("10px");
623+
expect(clearStyle.paddingLeft).toBe("6px");
624+
expect(clearStyle.paddingRight).toBe("6px");
625+
expect(clearStyle.cursor).toBe("pointer");
594626

595627
const duplicateIds = await page.evaluate(() => {
596628
const ids = [...document.querySelectorAll("[id]")].map((element) => element.id);
@@ -625,8 +657,25 @@ test.describe("Preview Generator V2 baseline", () => {
625657
await expect(exportToolStateButton).toBeEnabled();
626658
await exportButton.click();
627659
await expect(page.locator("#statusLog")).toHaveValue(/Processed source value/);
660+
await expect(templateStatusHeader).toHaveAttribute("aria-expanded", "true");
661+
await expect(templateStatusContent).toBeVisible();
662+
await page.locator("#clearStatusButton").click();
663+
await expect(page.locator("#statusLog")).toHaveValue("");
664+
await expect(templateStatusHeader).toHaveAttribute("aria-expanded", "true");
665+
await expect(templateStatusContent).toBeVisible();
666+
667+
await exportButton.click();
668+
await expect(page.locator("#statusLog")).toHaveValue(/Processed source value/);
669+
await templateStatusTitle.click();
670+
await expect(templateStatusContent).toBeHidden();
671+
await expect(templateStatusHeader).toHaveAttribute("aria-expanded", "false");
628672
await page.locator("#clearStatusButton").click();
629673
await expect(page.locator("#statusLog")).toHaveValue("");
674+
await expect(templateStatusHeader).toHaveAttribute("aria-expanded", "false");
675+
await expect(templateStatusContent).toBeHidden();
676+
await templateStatusTitle.click();
677+
await expect(templateStatusContent).toBeVisible();
678+
await expect(templateStatusHeader).toHaveAttribute("aria-expanded", "true");
630679

631680
await page.locator("#sourceInput").fill("");
632681
await expect(exportButton).toBeDisabled();

tools/templates-v2/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,14 @@ <h2 class="tools-platform-frame__eyebrow">First-Class Tools Surface V2</h2>
9292
</section>
9393

9494
<section class="accordion-v2 tool-starter__accordion is-open" data-accordion-v2-open="true">
95-
<button class="accordion-v2__header" type="button" aria-expanded="true" aria-controls="statusLogContent">
95+
<div class="accordion-v2__header tool-starter__status-accordion-header" aria-expanded="true" aria-controls="statusLogContent">
9696
<span>Status</span>
97-
<span class="accordion-v2__icon" aria-hidden="true">+</span>
98-
</button>
97+
<div class="tool-starter__status-header-actions">
98+
<button id="clearStatusButton" class="tool-starter__status-clear-button" type="button">Clear</button>
99+
<span class="accordion-v2__icon" aria-hidden="true">+</span>
100+
</div>
101+
</div>
99102
<div id="statusLogContent" class="accordion-v2__content">
100-
<button id="clearStatusButton" type="button">Clear</button>
101103
<textarea id="statusLog" readonly rows="10" aria-label="Status log"></textarea>
102104
</div>
103105
</section>

tools/templates-v2/js/controls/StatusLogControl.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ export class StatusLogControl {
55
}
66

77
mount() {
8-
this.clearButton.addEventListener("click", () => this.clear());
8+
this.clearButton.addEventListener("click", (event) => {
9+
event.stopPropagation();
10+
this.clear();
11+
});
912
}
1013

1114
clear() {
@@ -23,4 +26,3 @@ export class StatusLogControl {
2326
this.log.scrollTop = this.log.scrollHeight;
2427
}
2528
}
26-

tools/templates-v2/styles/toolStarter.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ textarea:focus-visible {
190190
font-weight: 700;
191191
padding: 10px 12px;
192192
text-align: left;
193+
cursor: pointer;
193194
}
194195

195196
.accordion-v2__icon {
@@ -221,6 +222,34 @@ textarea:focus-visible {
221222
display: none;
222223
}
223224

225+
.tool-starter__status-accordion-header {
226+
flex: 0 0 42px;
227+
min-width: 0;
228+
}
229+
230+
.tool-starter__status-header-actions {
231+
flex: 0 0 auto;
232+
display: inline-flex;
233+
align-items: center;
234+
gap: 8px;
235+
}
236+
237+
.tool-starter__status-clear-button {
238+
flex: 0 0 auto;
239+
margin-right: 0;
240+
border-color: var(--tool-starter-line) !important;
241+
border-radius: 10px !important;
242+
background: ButtonFace;
243+
color: ButtonText;
244+
padding: 2px 6px;
245+
}
246+
247+
.tool-starter__status-clear-button:hover {
248+
border-color: var(--tool-starter-line) !important;
249+
background: ButtonFace;
250+
color: ButtonText;
251+
}
252+
224253
.tool-starter__accordion--fill {
225254
flex: 1 1 auto;
226255
}

0 commit comments

Comments
 (0)