refactor(chess): unregister Empty layout — keep as internal fixture only
The Empty layout had no real user need: - Can't Play Solo (board with no pieces, nothing to click). - Server rejects it for Create Room (validator requires >=1 king per side). - The 'blank canvas' use case is already handled by the LayoutEditor's Custom... flow, which opens with an empty piece list and lets the user compose. It was UI clutter in the picker dropdown — users would see 'Empty Board' alongside real layouts and have no way to actually use it. EMPTY_LAYOUT stays exported for unit tests that need a zero-piece starting state, but it no longer registers in LAYOUT_REGISTRY, is not imported by the layouts barrel side-effects, and no longer appears in the picker. Source flipped to 'custom' to signal it's not a user-selectable premade. Tests updated: - premades.test.ts asserts 'empty' is NOT in the registry. - e2e/layouts.spec.ts removes the Empty-solo test and asserts the 'empty' option is absent from the picker dropdown. 1025 unit tests + 23 e2e tests green.
This commit is contained in:
parent
ee2c175963
commit
c6c79c678b
4 changed files with 31 additions and 53 deletions
|
|
@ -72,7 +72,9 @@ test.describe('LayoutPicker (lobby)', () => {
|
|||
|
||||
test('picker includes every expected premade', async ({ page }) => {
|
||||
const picker = page.getByTestId('layout-picker');
|
||||
// All premades + Custom entry.
|
||||
// All premades + Custom entry. "Empty" is intentionally absent —
|
||||
// it's a test fixture only, not a selectable starting position
|
||||
// (fails validation, serves no player need).
|
||||
for (const id of [
|
||||
'classic',
|
||||
'dunsany',
|
||||
|
|
@ -81,10 +83,10 @@ test.describe('LayoutPicker (lobby)', () => {
|
|||
'horde',
|
||||
'knightmate',
|
||||
'chess960',
|
||||
'empty',
|
||||
]) {
|
||||
await expect(picker.locator(`option[value="${id}"]`)).toHaveCount(1);
|
||||
}
|
||||
await expect(picker.locator('option[value="empty"]')).toHaveCount(0);
|
||||
await expect(picker.locator('option[value="__custom__"]')).toHaveCount(1);
|
||||
});
|
||||
|
||||
|
|
@ -284,32 +286,6 @@ test.describe('Solo play — layout selection reaches the engine', () => {
|
|||
}
|
||||
});
|
||||
|
||||
test('Empty layout Play Solo is disabled (no king = cannot create game)', async ({
|
||||
page,
|
||||
}) => {
|
||||
// The Empty layout has 0 pieces; the validator requires at least 1
|
||||
// king per side. This test documents current behavior: the Play
|
||||
// Solo button happily routes to /game regardless, but the engine
|
||||
// opens with zero pieces (equivalent to validateLayout errors
|
||||
// surfacing only on the multiplayer path, not solo). This is a
|
||||
// deliberate design call — solo mode lets users poke at any
|
||||
// layout including broken ones.
|
||||
//
|
||||
// If / when we add pre-flight validation for solo too, flip this
|
||||
// test to assert a blocked CTA.
|
||||
await page.goto('/');
|
||||
await page.getByTestId('layout-picker').selectOption('empty');
|
||||
await page.locator('[data-action="play-solo"]').click();
|
||||
await page.waitForURL('**/game');
|
||||
|
||||
// Board renders but is devoid of pieces.
|
||||
await expect(
|
||||
page.locator('[data-square="e1"] [data-piece]'),
|
||||
).toHaveCount(0);
|
||||
await expect(
|
||||
page.locator('[data-square="e8"] [data-piece]'),
|
||||
).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue