Phase 1: PWA auto-update, player-view map fit fix, encounter picker
- PWA registerType autoUpdate + skipWaiting/clientsClaim/cleanupOutdatedCaches so
a fresh deploy reaches browsers without a manual hard-reload (the old 'prompt'
served the stale cached bundle, hiding shipped fixes like the polygon outline).
- MapCanvas: always mount the outer container so the ResizeObserver binds even when
the map image arrives late over WebSocket — fixes the networked player view
showing the map at 100% instead of fit ("3x magnified").
- TokenPalette: encounter picker for planned AND active encounters (was active-only),
with per-encounter "+ All" and counts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,30 @@ test('maps: zoom controls scale the canvas and fit resets', async ({ page }) =>
|
||||
expect(await scaleOf()).toBeCloseTo(fitZoom, 5);
|
||||
});
|
||||
|
||||
test('maps: place a token from a planned encounter via the palette', async ({ page }) => {
|
||||
await page.getByRole('button', { name: '+ New campaign' }).first().click();
|
||||
await page.locator('input[data-autofocus]').fill('Enc');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// A planned (not-yet-started) encounter with a monster.
|
||||
await page.getByRole('link', { name: 'Combat' }).click();
|
||||
await page.getByRole('button', { name: '+ New encounter' }).first().click();
|
||||
await page.locator('input[data-autofocus]').fill('Ambush');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByLabel('Name').fill('Bandit');
|
||||
await page.getByRole('button', { name: 'Add', exact: true }).click();
|
||||
|
||||
await page.getByRole('link', { name: 'Dashboard' }).click();
|
||||
await page.getByRole('link', { name: 'Maps' }).click();
|
||||
await page.locator('input[type="file"]').setInputFiles('public/pwa-512x512.png');
|
||||
|
||||
// The palette's Encounter section surfaces the planned encounter's combatant.
|
||||
await expect(page.getByText('Encounter', { exact: true })).toBeVisible();
|
||||
await page.getByRole('button', { name: /Bandit/ }).click();
|
||||
await expect(page.getByTestId('map-token')).toHaveCount(1);
|
||||
await expect(page.getByTestId('map-token')).toContainText('Bandit');
|
||||
});
|
||||
|
||||
test('maps: place a party token from the palette', async ({ page }) => {
|
||||
await page.getByRole('button', { name: '+ New campaign' }).first().click();
|
||||
await page.locator('input[data-autofocus]').fill('Party');
|
||||
|
||||
Reference in New Issue
Block a user