Commit Graph

6 Commits

Author SHA1 Message Date
c8280e156f Add comprehensive Playwright tests for all geography demos (61 tests)
Tests every page under /sx/(geography...):
- 9 section index pages (geography, reactive, hypermedia, marshes, etc.)
- 16 reactive island demos with interaction tests (counter, temperature,
  stopwatch, input-binding, dynamic-class, reactive-list, stores, etc.)
- 27 hypermedia demos (click-to-load, form-submission, tabs, etc.)
- Cross-navigation reactivity (counter → temperature → counter)
- Sequential 5-demo navigation test
- CEK, marshes, isomorphism, scopes, spreads, provide, reference pages

Total Playwright tests: 72 (6 isomorphic + 5 reactive-nav + 61 geography)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 17:50:48 +00:00
732d733eac Fix island reactivity lost on client-side navigation; add Playwright tests
When morphing DOM after server fetch, the morph engine reuses elements
with the same tag. If old element was island A and new is island B,
syncAttrs updates data-sx-island but the JS property _sxBoundisland-hydrated
persists on the reused element. sx-hydrate-islands then skips it.

Fix: in morphNode, when data-sx-island attribute changes between old and
new elements, dispose the old island's signals and clear the hydration
flag so the new island gets properly hydrated.

New Playwright tests:
- counter → temperature navigation: temperature signals work
- temperature → counter navigation: counter signals work
- Direct load verification for both islands
- No JS errors during navigation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 17:36:51 +00:00
e887c0d978 Fix defisland→Component bug in jinja_bridge; add island reactivity test
jinja_bridge.py was creating Component objects for both defcomp AND
defisland forms. Islands need Island objects so the serializer emits
defisland (not defcomp) in the client component bundle. Without this,
client-side islands don't get data-sx-island attributes, hydration
fails, and all reactive signals (colour cycling, stepper) stop working.

Add Playwright test: islands hydrate, stepper buttons update count,
reactive colour cycling works on click.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:48:19 +00:00
9caf8b6e94 Fix runtime PRIMITIVES for dom/browser library functions
dom.sx and browser.sx are library source (not transpiled into the bundle),
so their functions need explicit PRIMITIVES registration for runtime-eval'd
SX code (islands, data-init scripts). Restore registrations for all dom/
browser functions used at runtime. Revert bootstrap.py transpilation of
dom-lib/browser-lib which overrode native platform implementations that
have essential runtime integration (cekCall wrapping, post-render hooks).

Add Playwright regression test for [object Object] nav link issue.
Replace console-log calls with log-info in init-client.sx.txt.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 12:10:54 +00:00
49b03b246d Stricter isomorphic test: exact DOM structure + text comparison
Test 2 now compares JSON.stringify of the full DOM tree structure
(tags, ids, classes, island markers, lake markers) and exact text
content between JS-disabled and JS-enabled renders.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 20:12:17 +00:00
33a02c8fe1 Playwright tests for isomorphic SSR
4 tests verifying server-client rendering parity:
1. SSR renders visible content without JavaScript (headings, islands, logo)
2. JS-rendered content matches SSR structure (same article text)
3. CSSX styling works without JS (violet class, rules in <head>)
4. SPA navigation preserves island state (colour + copyright path)

Run: cd tests/playwright && npx playwright test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 20:10:35 +00:00