HS: nil guard in hs-on for missing targets (+1 test)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

When `from #doesntExist` resolves to nil, hs-on silently skips
listener registration instead of crashing on dom-listen nil.
Removes "can ignore when target doesn't exist" from skip-list.

Also adds host-make-js-thrower native utility (plain JS throwing
function, no K.callFn re-entry) — investigated for the js-exceptions
catch test but that test stays skipped: native JS throws from host
calls escape OCaml WASM try-with guards.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 14:03:07 +00:00
parent 82d16597e0
commit 1751cd05ea
4 changed files with 31 additions and 10 deletions

View File

@@ -109,10 +109,8 @@ SKIP_TEST_NAMES = {
"can be in a top level script tag",
"multiple event handlers at a time are allowed to execute with the every keyword",
"each behavior installation has its own event queue",
"can catch exceptions thrown in js functions",
"can catch exceptions thrown in hyperscript functions",
"can ignore when target doesn't exist",
"can ignore when target doesn\\'t exist",
"can catch exceptions thrown in js functions",
"can handle an or after a from clause",
# upstream 'fetch' category — real DocumentFragment semantics (`its childElementCount`
# after `as html`) not exercisable with our DOM mock.
@@ -202,6 +200,16 @@ MANUAL_TEST_BODIES = {
"basic classRef works w no match": [
' (assert= (len (eval-hs ".badClassThatDoesNotHaveAnyElements")) 0)',
],
# on from: if target resolves to nil, hs-on silently skips registration
"can ignore when target doesn't exist": [
' (hs-cleanup!)',
' (let ((_el (dom-create-element "div")))',
' (dom-set-attr _el "_" "on click from #doesntExist throw \\"bar\\" on click put \\"clicked\\" into me")',
' (dom-append (dom-body) _el)',
' (hs-activate! _el)',
' (dom-dispatch _el "click" nil)',
' (assert= (dom-get-inner-html _el) "clicked"))',
],
# bootstrap: restore correct bodies that auto-regen gets wrong
"can call functions": [
' (hs-cleanup!)',