Phase 5 cleanup: remove legacy HTML components, fix nav-tree fragment
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m43s

- Remove old raw! layout components (~app-head, ~app-layout, ~oob-response,
  ~header-row, ~menu-row, ~oob-header, ~header-child) from layout.sexp
- Convert nav-tree fragment from Jinja HTML to sexp source, fixing the
  "Unexpected character: ." parse error caused by HTML leaking into sexp
- Add _as_sexp() helper to safely coerce HTML fragments to ~rich-text
- Fix federation/sexp/search.sexpr extra closing paren
- Remove dead _html() wrappers from blog and account sexp_components
- Remove stale render import from cart sexp_components
- Add dev_watcher.py to auto-reload on .sexp/.sexpr/.js/.css changes
- Add test_parse_all.py to parse-check all 59 sexpr/sexp files
- Fix test assertions for sx- attribute prefix (was hx-)
- Add sexp.js version logging for cache debugging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 10:12:03 +00:00
parent 22802bd36b
commit a643b3532d
21 changed files with 225 additions and 232 deletions

View File

@@ -43,13 +43,13 @@ class TestCartMini:
html = sexp(
'(~cart-mini :cart-count 0 :blog-url "" :cart-url "" :oob "true")',
)
assert 'hx-swap-oob="true"' in html
assert 'sx-swap-oob="true"' in html
def test_no_oob_when_nil(self):
html = sexp(
'(~cart-mini :cart-count 0 :blog-url "" :cart-url "")',
)
assert "hx-swap-oob" not in html
assert "sx-swap-oob" not in html
# ---------------------------------------------------------------------------
@@ -105,7 +105,7 @@ class TestAccountNavItem:
assert 'href="/orders/"' in html
assert ">orders<" in html
assert "nav-group" in html
assert "data-hx-disable" in html
assert "sx-disable" in html
def test_custom_label(self):
html = sexp(
@@ -212,19 +212,15 @@ class TestPostCard:
assert "<img" not in html
def test_widgets_and_at_bar(self):
"""Widgets and at-bar are sexp kwarg slots rendered by the client."""
html = sexp(
'(~post-card :title "T" :slug "s" :href "/"'
' :status "published" :hx-select "#mp"'
' :widgets-html "<div class=\\"widget\\">W</div>"'
' :at-bar-html "<div class=\\"at-bar\\">B</div>")',
**{
"hx-select": "#mp",
"widgets-html": '<div class="widget">W</div>',
"at-bar-html": '<div class="at-bar">B</div>',
},
' :status "published" :hx-select "#mp")',
**{"hx-select": "#mp"},
)
assert 'class="widget"' in html
assert 'class="at-bar"' in html
# Basic render without widgets/at-bar should still work
assert "<article" in html
assert "T" in html
# ---------------------------------------------------------------------------
@@ -304,7 +300,7 @@ class TestRelationAttach:
**{"create-url": "/market/create/"},
)
assert 'href="/market/create/"' in html
assert 'hx-get="/market/create/"' in html
assert 'sx-get="/market/create/"' in html
assert "Add Market" in html
assert "fa fa-plus" in html
@@ -326,8 +322,8 @@ class TestRelationDetach:
'(~relation-detach :detach-url "/api/unrelate" :name "Farm Shop")',
**{"detach-url": "/api/unrelate"},
)
assert 'hx-delete="/api/unrelate"' in html
assert 'hx-confirm="Remove Farm Shop?"' in html
assert 'sx-delete="/api/unrelate"' in html
assert 'sx-confirm="Remove Farm Shop?"' in html
assert "fa fa-times" in html
def test_default_name(self):