Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .ai/contexts/tool-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,14 @@ the shell sizing and tool state regressions.
`e2e/tool-bar.spec.js`: E1-E8, including the 32-case overflow matrix and
width restoration. These Electron journeys run only in CI; local jsdom tests
do not prove rendered geometry or native Tab traversal.

E4 reapplies each short/long title pair and reads all header rectangles in one
synchronous renderer evaluation. Separate `boundingBox()` calls (CDP
`DOM.getBoxModel`) do not come from one layout: in #1163, right after the
800→1400 resize, the id came from a layout without E4's labels and Refresh from
one with them (~95 px apart), while `getBoundingClientRect` in one synchronous
pass forces a single coherent layout. A bounded `toPass` retries the complete
geometry assertions, retaining the nonnegative gap strictly below 24 CSS px
and the id/control containment checks; each retry reapplies the requested
titles. Other journeys still read boxes in separate calls after a resize
(`geometry()` in E1/E5/E5b/E6).
44 changes: 25 additions & 19 deletions e2e/tool-bar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,31 @@ test('E4: Refresh stays beside the id with short and long session and PTY titles
await viewport(app, page, width);
for (const name of ['Session', 'Session '.repeat(30)]) {
for (const title of ['Shell', 'Program title '.repeat(30)]) {
await page.evaluate(({ name, title }) => {
document.getElementById('terminal-header-name').textContent = name;
const el = document.getElementById('terminal-header-pty-title');
el.textContent = title;
el.style.display = '';
}, { name, title });
const id = await box(page.locator('#terminal-header-id'));
const info = await box(page.locator('#terminal-header-info'));
const refresh = await box(page.locator('#terminal-refresh-btn'));
const stop = await box(page.locator('#terminal-stop-btn'));
const header = await box(page.locator('#terminal-header'));
expect(id.x).toBeGreaterThanOrEqual(info.x);
expect(id.x + id.width).toBeLessThanOrEqual(info.x + info.width + 1);
expect(refresh.x - id.x - id.width).toBeGreaterThanOrEqual(0);
expect(refresh.x - id.x - id.width).toBeLessThan(24);
for (const control of [refresh, stop]) {
expect(control.x).toBeGreaterThanOrEqual(header.x);
expect(control.x + control.width).toBeLessThanOrEqual(header.x + header.width);
}
await expect(async () => {
const [id, info, refresh, stop, header] = await page.evaluate(({ name, title }) => {
document.getElementById('terminal-header-name').textContent = name;
const el = document.getElementById('terminal-header-pty-title');
el.textContent = title;
el.style.display = '';
return ['terminal-header-id', 'terminal-header-info', 'terminal-refresh-btn', 'terminal-stop-btn', 'terminal-header']
.map(id => {
const { x, width, height } = document.getElementById(id).getBoundingClientRect();
return { x, width, height };
});
}, { name, title });
for (const rect of [id, info, refresh, stop, header]) {
expect(rect.width).toBeGreaterThan(0);
expect(rect.height).toBeGreaterThan(0);
}
expect(id.x).toBeGreaterThanOrEqual(info.x);
expect(id.x + id.width).toBeLessThanOrEqual(info.x + info.width + 1);
expect(refresh.x - id.x - id.width).toBeGreaterThanOrEqual(0);
expect(refresh.x - id.x - id.width).toBeLessThan(24);
for (const control of [refresh, stop]) {
expect(control.x).toBeGreaterThanOrEqual(header.x);
expect(control.x + control.width).toBeLessThanOrEqual(header.x + header.width);
}
}).toPass({ timeout: 5000 });
await expect(page.locator('#terminal-header [data-header-kind="toggle"]')).toHaveCount(0);
}
}
Expand Down
Loading