fix(post): cover the code-review fixes; mark location-override plan complete
Adds Playwright coverage for the four cross-reviewer-confirmed bugs fixed in the user/ submodule (map-load race on rapid reopen, mismatch flag clearing on blank, and submit blocked on unresolved mismatch), and bumps the user/ pointer to the commit with those fixes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ execution: code
|
||||
|
||||
# Post Form Location Override - Plan
|
||||
|
||||
**Status:** 📋 Not started
|
||||
**Status:** ✅ Complete (2026-07-24)
|
||||
|
||||
## Goal Capsule
|
||||
|
||||
|
||||
@@ -258,6 +258,65 @@ test('typing an invalid lat value shows the mismatch flag and clears once fixed'
|
||||
await expect(page.locator('#location-map .maplibregl-marker')).toHaveCount(1);
|
||||
});
|
||||
|
||||
// ── U4: rapid close/reopen while the maplibre-gl chunk is still in flight must
|
||||
// not build two Map instances against the same container (code-review fix) ──
|
||||
test('rapid close/reopen before the maplibre-gl chunk resolves still leaves exactly one canvas', async ({ page }) => {
|
||||
await page.route('**/*maplibre-gl*.js', async (route) => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
await route.continue();
|
||||
});
|
||||
await page.goto('/post');
|
||||
|
||||
// Open, then immediately close and reopen — both toggles land while the
|
||||
// delayed chunk request above is still pending.
|
||||
await page.locator('.location-details__summary').click();
|
||||
await page.locator('.location-details__summary').click();
|
||||
await page.locator('.location-details__summary').click();
|
||||
await expect(page.locator('.location-details')).toHaveJSProperty('open', true);
|
||||
|
||||
await expect(page.locator('#location-map canvas.maplibregl-canvas')).toHaveCount(1, { timeout: 10_000 });
|
||||
});
|
||||
|
||||
// ── U5: blanking both fields after a mismatch was flagged clears the flag ──
|
||||
test('blanking both lat/lng fields after a mismatch clears the flag', async ({ page }) => {
|
||||
await page.goto('/post');
|
||||
await openLocationDetails(page);
|
||||
|
||||
const latEl = page.locator('input[name="data[lat]"]');
|
||||
const lngEl = page.locator('input[name="data[lng]"]');
|
||||
await latEl.fill('not-a-number');
|
||||
await lngEl.blur();
|
||||
await expect(latEl).toHaveClass(/location-field--mismatch/);
|
||||
|
||||
await latEl.fill('');
|
||||
await lngEl.fill('');
|
||||
await lngEl.blur();
|
||||
await expect(latEl).not.toHaveClass(/location-field--mismatch/);
|
||||
await expect(lngEl).not.toHaveClass(/location-field--mismatch/);
|
||||
});
|
||||
|
||||
// ── U5: a flagged, unresolved lat/lng must block submit (code-review fix) ──
|
||||
test('submitting with an unresolved lat/lng mismatch is blocked', async ({ page }) => {
|
||||
const tag = `loc-mismatch-${Date.now()}`;
|
||||
await page.goto('/post');
|
||||
await page.fill('input[name="data[title]"]', `UI Test ${tag}`);
|
||||
await fillEditor(page, 'Location-override mismatch-blocks-submit guard. Safe to delete.');
|
||||
await page.locator('input.filepond--browser').setInputFiles(TEST_PHOTO);
|
||||
await waitForPhotoUpload(page);
|
||||
|
||||
await openLocationDetails(page);
|
||||
const latEl = page.locator('input[name="data[lat]"]');
|
||||
const lngEl = page.locator('input[name="data[lng]"]');
|
||||
await latEl.fill('999');
|
||||
await lngEl.fill('999');
|
||||
await lngEl.blur();
|
||||
await expect(latEl).toHaveClass(/location-field--mismatch/);
|
||||
|
||||
await page.locator('.btn-post').evaluate((el) => el.click());
|
||||
await expect(page.locator('.notices')).toHaveCount(0);
|
||||
await expect(page).toHaveURL(/\/post/);
|
||||
});
|
||||
|
||||
// ── U4: lazy-load boundary — an ordinary GPS-only submit never fetches maplibre-gl ──
|
||||
test('an ordinary submit without opening the panel never fetches the maplibre-gl chunk', async ({ page }) => {
|
||||
const chunkRequests = [];
|
||||
|
||||
+1
-1
Submodule user updated: 02fa4e94a7...13c76b29a8
Reference in New Issue
Block a user