Stepper persistence: use def-store instead of broken cookies
The home stepper's step-idx signal was not persisting across SX navigation because set-cookie/freeze-to-sx wasn't working in the WASM kernel. Replace with def-store which uses a global registry that survives island re-hydration. Also fix sx_http.exe build: add sx_http back to dune, inline scope primitives (Sx_scope module was removed), add declarative form stubs and render stubs, fix /sx/ home route mapping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -125,6 +125,46 @@ test.describe('Page Navigation', () => {
|
||||
expect(after).toContain('geography');
|
||||
});
|
||||
|
||||
test('stepper persists index across navigation', async ({ page }) => {
|
||||
await page.goto(BASE_URL + '/sx/', { waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Get the initial stepper index
|
||||
const getIndex = () => page.evaluate(() => {
|
||||
const el = document.querySelector('[data-sx-island="home/stepper"]');
|
||||
const m = el && el.textContent.match(/(\d+)\s*\/\s*\d+/);
|
||||
return m ? parseInt(m[1]) : null;
|
||||
});
|
||||
|
||||
const initial = await getIndex();
|
||||
expect(initial).not.toBeNull();
|
||||
|
||||
// Advance the stepper
|
||||
await page.evaluate(() => {
|
||||
const btns = document.querySelectorAll('[data-sx-island="home/stepper"] button');
|
||||
if (btns.length >= 2) btns[1].click(); // next button
|
||||
});
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const advanced = await getIndex();
|
||||
expect(advanced).toBe(initial + 1);
|
||||
|
||||
// Navigate away
|
||||
await page.click('a[sx-get*="(geography)"]');
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Navigate back home
|
||||
await page.evaluate(() => {
|
||||
const link = document.querySelector('a[sx-get*="/sx/"]');
|
||||
if (link) link.click();
|
||||
});
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Stepper should still show the advanced index
|
||||
const afterNav = await getIndex();
|
||||
expect(afterNav).toBe(advanced);
|
||||
});
|
||||
|
||||
test('header island renders with SSR', async ({ page }) => {
|
||||
await page.goto(BASE_URL + '/sx/(geography)', { waitUntil: 'networkidle' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user