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
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:
@@ -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).
|
||||
|
||||
@@ -26,6 +26,27 @@ test('landscape lays the game in two columns with the history docked open', asyn
|
||||
await expect(page.locator('.leftpane .tabbar')).toBeVisible();
|
||||
});
|
||||
|
||||
test('the docked history shows the newest move', async ({ page }) => {
|
||||
// Stretch the cells so the seeded four-move game overflows the docked table's scroller — the
|
||||
// condition under which "shows the newest move" is observable at all. Injected at document
|
||||
// start: in landscape the table is docked open from the mount, and it is pinned to its last row
|
||||
// as soon as the moves arrive. The portrait (drawer) counterpart lives in history.spec.ts.
|
||||
await page.addInitScript(() => {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const style = document.createElement('style');
|
||||
style.textContent = '.hcell { min-height: 200px !important; }';
|
||||
document.head.append(style);
|
||||
});
|
||||
});
|
||||
await openGame(page);
|
||||
|
||||
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('landscape zooms the board on a double-tap and the zoomed board overflows the pane', async ({ page }) => {
|
||||
await openGame(page);
|
||||
// Double-tap an empty cell zooms in, same as portrait. The board is height-driven here, so the
|
||||
|
||||
Reference in New Issue
Block a user