Build tooling: updated OCaml bootstrapper, compile-modules, bundle.sh, sx-build-all. WASM browser: rebuilt sx_browser.bc.js/wasm, sx-platform-2.js, .sxbc bytecode files. CSSX/Tailwind: reworked cssx.sx templates and tw-layout, added tw-type support. Content: refreshed essays, plans, geography, reactive islands, docs, demos, handlers. New tools: bisect_sxbc.sh, test-spa.js, render-trace.sx, morph playwright spec. Tests: added test-match.sx, test-examples.sx, updated test-tw.sx and web tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
const { test, expect } = require('playwright/test');
|
|
const { BASE_URL, waitForSxReady, loadPage } = require('./helpers');
|
|
|
|
test.describe('SPA morph swap', () => {
|
|
|
|
test('old content removed after SPA nav', async ({ page }) => {
|
|
await loadPage(page, ''); // home
|
|
expect(await page.$('#main-content')).not.toBeNull();
|
|
|
|
await page.click('a[sx-get*="(geography)"]');
|
|
await expect(page).toHaveURL(/geography/, { timeout: 5000 });
|
|
await page.waitForTimeout(1500);
|
|
|
|
expect(await page.$('#main-content'), '#main-content should be removed').toBeNull();
|
|
});
|
|
|
|
test('stepper island removed after SPA nav', async ({ page }) => {
|
|
await loadPage(page, '');
|
|
expect(await page.$('[data-sx-island="home/stepper"]')).not.toBeNull();
|
|
|
|
await page.click('a[sx-get*="(geography)"]');
|
|
await expect(page).toHaveURL(/geography/, { timeout: 5000 });
|
|
await page.waitForTimeout(1500);
|
|
|
|
expect(await page.$('[data-sx-island="home/stepper"]'), 'stepper should be gone').toBeNull();
|
|
});
|
|
|
|
test('header state updates after SPA nav', async ({ page }) => {
|
|
await loadPage(page, '');
|
|
await page.click('a[sx-get*="(geography)"]');
|
|
await expect(page).toHaveURL(/geography/, { timeout: 5000 });
|
|
await page.waitForTimeout(1500);
|
|
|
|
const state = await page.$eval('[data-sx-island="layouts/header"]',
|
|
el => el.getAttribute('data-sx-state'));
|
|
expect(state, 'header state should have geography path').toContain('geography');
|
|
});
|
|
});
|