mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
fix: apply the review items for #689 at merge
Clamp the stored toolbar width to MIN_WIDTH in apply() and step the arrow keys from the width on screen, so a drag to the window edge or a held ArrowRight no longer stores a negative width or leaves an ArrowLeft dead zone (browser test added) Drop Escape as a reset key on the handle: the global capture-phase Escape handler already closes every panel on it (static pin added) Say in the changeset, the wiki and the densityFor comment that the percentages go at the narrowest step in the Compact style only, and drop Escape from the changeset Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f3c90abeb0
commit
34a2966c19
5 files changed
+34
-9
No files matched your search
@@ -126,6 +126,28 @@ describe('header divider (real Chromium)', () => {
|
||||
await p.close();
|
||||
});
|
||||
|
||||
it('never stores a width below the minimum, and widens on the first ArrowLeft after a held ArrowRight', async () => {
|
||||
await open({ chip: true });
|
||||
const stored = () => p.evaluate(() => Number(localStorage.getItem('codeman-header-right-width')));
|
||||
// a drag into the window's last pixels used to store a negative width, which the next load dropped
|
||||
await dragTo(-6);
|
||||
expect(await stored()).toBeGreaterThanOrEqual(160);
|
||||
await p.locator('.header-divider').dblclick();
|
||||
await p.locator('.header-divider').focus();
|
||||
for (let i = 0; i < 60; i++) await p.keyboard.press('ArrowRight');
|
||||
await settled();
|
||||
expect(await stored()).toBeGreaterThanOrEqual(160);
|
||||
const floor = (await box('#headerRight')).width;
|
||||
// Escape is the global close-panels key, not a reset
|
||||
await p.keyboard.press('Escape');
|
||||
await settled();
|
||||
expect(Math.abs((await box('#headerRight')).width - floor)).toBeLessThan(2);
|
||||
await p.keyboard.press('ArrowLeft');
|
||||
await settled();
|
||||
expect((await box('#headerRight')).width).toBeGreaterThan(floor);
|
||||
await p.close();
|
||||
});
|
||||
|
||||
it('stops the divider at the widest reading so nothing pokes out past it', async () => {
|
||||
await open({ chip: true });
|
||||
await dragTo(20);
|
||||
|
||||
@@ -69,6 +69,8 @@ describe('header divider', () => {
|
||||
expect(js).toContain('localStorage');
|
||||
expect(js).not.toContain('/api/settings');
|
||||
expect(js).toMatch(/key === 'Home'/);
|
||||
// Escape belongs to the global close-panels handler (app.js), so the handle must not claim it too.
|
||||
expect(js).not.toMatch(/'Escape'/);
|
||||
expect(js).toContain("addEventListener('dblclick'");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user