feat(ui): open the move history at the newest move; scale the landscape rack glyphs
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 1m18s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 2m6s

The move table fills top to bottom, oldest first, so it used to open on the
opening moves — the least interesting end of a long game. Pin it to its last
row when it is shown (the portrait drawer and the landscape dock alike), once
per showing rather than on every arriving move, so a player reading back
through the journal is not yanked to the bottom by an opponent's move.

The landscape tray shares the narrow left panel, so its tiles — and with them
the cqw-sized glyphs — come out markedly smaller than the full-width portrait
tray. Scale the letter and Erudit's blank star up a quarter there; the point
value keeps its size (it reads fine small, and growing it would crowd the
letter on a tile that size).
This commit is contained in:
Ilia Denisov
2026-07-27 21:11:34 +02:00
parent f383442430
commit 92700d0646
5 changed files with 96 additions and 2 deletions
+26
View File
@@ -121,6 +121,32 @@ test('a two-finger pinch does not open the history (pinch-zoom vs swipe-down)',
await expect(page.locator('.history')).toHaveCount(0);
});
/** tallHistoryRows stretches the move-table cells so the seeded four-move game overflows the
* table's scroller — the condition under which "opens at the newest move" is observable at all
* (with no overflow the assertion would hold vacuously). Injected at document start, since the
* table is pinned as soon as it is shown. */
async function tallHistoryRows(page: Page): Promise<void> {
await page.addInitScript(() => {
document.addEventListener('DOMContentLoaded', () => {
const style = document.createElement('style');
style.textContent = '.hcell { min-height: 200px !important; }';
document.head.append(style);
});
});
}
test('the history opens scrolled to the newest move', async ({ page }) => {
await tallHistoryRows(page);
await openGame(page);
await page.locator('.scoreboard').click(); // open the history
const m = await page
.locator('.hgridwrap')
.evaluate((el) => ({ top: el.scrollTop, scroll: el.scrollHeight, client: el.clientHeight }));
expect(m.scroll).toBeGreaterThan(m.client); // the table really overflows — no vacuous pass
expect(m.top).toBeGreaterThanOrEqual(m.scroll - m.client - 1); // pinned to the last row
});
test('a swipe-down on the zoomed-in board does not open the history (native scroll wins)', async ({ page }) => {
await openGame(page);
// Double-tap an empty cell to zoom in (two synchronous clicks = a double-tap).