fix(chess): global Esc handler + stable test selectors for layouts e2e

- LayoutEditor: move Esc handling to a window keydown listener so
  the modal closes regardless of where focus currently sits (the
  prior onKeyDown on the modal div only fired when the root div
  itself held focus).
- LayoutPicker: add data-testid on the description <p> so e2e
  assertions can target it unambiguously instead of relying on
  free-text matches that also select the hidden <option> labels.
- e2e: use the new testid.

All 12 layouts e2e tests pass; existing multiplayer + full-flow
e2e suites still green.
This commit is contained in:
Joey Yakimowich-Payne 2026-04-18 20:23:07 -06:00
commit 89c22d6bd5
No known key found for this signature in database
3 changed files with 21 additions and 3 deletions

View file

@ -52,7 +52,9 @@ test.describe('LayoutPicker (lobby)', () => {
test('selecting Dunsany updates the description', async ({ page }) => {
const picker = page.getByTestId('layout-picker');
await picker.selectOption('dunsany');
await expect(page.locator('text=/Dunsany/i').first()).toBeVisible();
await expect(
page.getByTestId('layout-picker-description'),
).toContainText(/pawn tide/i);
});
test('?layoutId=dunsany query param pre-selects the layout', async ({ page }) => {