fix(review): make the mismatch-blocks-submit test able to fail; carve out the map doctrine
The U5 guard asserted only `.notices` toHaveCount(0) and toHaveURL(/\/post/). Both pass instantly, and both also hold for a *successful* submit — the form posts to /post and only renders its notice after the round trip, and the click is dispatched via evaluate(el => el.click()), which skips Playwright's navigation-aware waiting. So the one test standing between a bad coordinate and the server could not fail. It now proves the negative on disk via findEntry() after a settling interval, registers the tag for cleanup before the click, and asserts the flag and value survived. CLAUDE.md's "one map path" section stated flatly that a single map code path exists, which location-map.js now contradicts. Recorded it as the one sanctioned exception (an editor, not a display map; lazy-imported; shares only MAP_STYLE) rather than leaving the doctrine wrong. The `user` gitlink is deliberately NOT bumped here: its pin already points at an unpushed submodule commit, which must be pushed and re-pointed before this branch merges. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -312,9 +312,21 @@ test('submitting with an unresolved lat/lng mismatch is blocked', async ({ page
|
||||
await lngEl.blur();
|
||||
await expect(latEl).toHaveClass(/location-field--mismatch/);
|
||||
|
||||
// Register for cleanup BEFORE the click: if the gate ever regresses, the
|
||||
// entry lands on disk and the afterAll hook must still see the tag.
|
||||
created.push(tag);
|
||||
await page.locator('.btn-post').evaluate((el) => el.click());
|
||||
await expect(page.locator('.notices')).toHaveCount(0);
|
||||
await expect(page).toHaveURL(/\/post/);
|
||||
|
||||
// `.notices` toHaveCount(0) and toHaveURL(/\/post/) both pass instantly and
|
||||
// both also hold for a SUCCESSFUL submit (the form posts to /post and only
|
||||
// renders its notice after the round trip), so neither can distinguish a
|
||||
// working gate from a regressed one. Prove the negative on disk instead,
|
||||
// after giving a regressed submit time to actually write.
|
||||
await page.waitForTimeout(2000);
|
||||
expect(findEntry(tag), 'a flagged coordinate must never reach the server').toBeFalsy();
|
||||
// And prove the block was the gate's doing: still flagged, value untouched.
|
||||
await expect(latEl).toHaveClass(/location-field--mismatch/);
|
||||
await expect(latEl).toHaveValue('999');
|
||||
});
|
||||
|
||||
// ── U4: lazy-load boundary — an ordinary GPS-only submit never fetches maplibre-gl ──
|
||||
|
||||
Reference in New Issue
Block a user