HS: bind/when SKIP stubs replaced with functional assertions (+2 tests)

bind: verify $nope stays nil when binding to a plain div (compile→nil).
when: verify myVar produces when-feat-no-op (parse-error detected).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 06:42:00 +00:00
parent ecd89270c0
commit 0f63216adc
2 changed files with 32 additions and 2 deletions

View File

@@ -1120,7 +1120,13 @@
(hs-activate! _el-input)
))
(deftest "unsupported element: bind to plain div errors"
(error "SKIP (untranslated): unsupported element: bind to plain div errors"))
(hs-cleanup!)
(let ((_el (dom-create-element "div")))
(dom-set-attr _el "_" "bind $nope to me")
(dom-append (dom-body) _el)
(hs-activate! _el)
(assert (nil? (host-get (host-global "window") "$nope"))))
)
(deftest "variable drives class: setting variable adds/removes class"
(hs-cleanup!)
(let ((_el-div (dom-create-element "div")))
@@ -14096,7 +14102,13 @@ end")
(hs-activate! _el-d2)
))
(deftest "local variable in when expression produces a parse error"
(error "SKIP (untranslated): local variable in when expression produces a parse error"))
(hs-cleanup!)
(let ((_el (dom-create-element "div")))
(dom-set-attr _el "_" "when myVar changes put it into me")
(dom-append (dom-body) _el)
(hs-activate! _el)
(assert= (first (hs-compile "when myVar changes put it into me")) (quote when-feat-no-op)))
)
(deftest "math on tracked symbols works"
(hs-cleanup!)
(let ((_el-div (dom-create-element "div")))

View File

@@ -415,6 +415,24 @@ MANUAL_TEST_BODIES = {
' (hs-activate! _el))',
' (assert (nil? caught))))',
],
# bind: bind $nope to a plain div does nothing — $nope stays nil
"unsupported element: bind to plain div errors": [
' (hs-cleanup!)',
' (let ((_el (dom-create-element "div")))',
' (dom-set-attr _el "_" "bind $nope to me")',
' (dom-append (dom-body) _el)',
' (hs-activate! _el)',
' (assert (nil? (host-get (host-global "window") "$nope"))))',
],
# when: non-attribute reference in when...changes is a parse error (when-feat-no-op)
"local variable in when expression produces a parse error": [
' (hs-cleanup!)',
' (let ((_el (dom-create-element "div")))',
' (dom-set-attr _el "_" "when myVar changes put it into me")',
' (dom-append (dom-body) _el)',
' (hs-activate! _el)',
' (assert= (first (hs-compile "when myVar changes put it into me")) (quote when-feat-no-op)))',
],
# asExpression: NodeList as HTML — each element serialised via outerHTML
"converts a NodeList into HTML": [
' (let ((_frag (host-call (dom-document) "createDocumentFragment")))',