diff --git a/spec/tests/test-hyperscript-behavioral.sx b/spec/tests/test-hyperscript-behavioral.sx index 3b7255c2..6db20056 100644 --- a/spec/tests/test-hyperscript-behavioral.sx +++ b/spec/tests/test-hyperscript-behavioral.sx @@ -1172,7 +1172,7 @@ )) (deftest "can call global javascript functions" (hs-cleanup!) - (host-set! (host-global "window") "calledWith" null) + (host-set! (host-global "window") "calledWith" nil) (let ((_el-div (dom-create-element "div"))) (dom-set-attr _el-div "_" "on click call globalFunction(\"foo\")") (dom-append (dom-body) _el-div) diff --git a/tests/hs-run-filtered.js b/tests/hs-run-filtered.js index a3978dce..ff2b6231 100755 --- a/tests/hs-run-filtered.js +++ b/tests/hs-run-filtered.js @@ -399,6 +399,8 @@ globalThis.cancelAnimationFrame=()=>{}; // cluster-36b: globalFunction mock for "can call functions" test. // The test calls globalFunction("foo") via hyperscript and checks window.calledWith. globalThis.globalFunction = function(x) { globalThis.calledWith = x; }; +// asyncCheck: async-when test needs a truthy-returning global (simulates async guard). +globalThis.asyncCheck = function() { return true; }; // cluster-asyncError: function that returns a rejected promise. globalThis.failAsync = function() { return Promise.reject(new Error("boom")); }; // HsMutationObserver — cluster-32 mutation mock. Maintains a global diff --git a/tests/playwright/generate-sx-tests.py b/tests/playwright/generate-sx-tests.py index 718a9131..2f7cf5f0 100644 --- a/tests/playwright/generate-sx-tests.py +++ b/tests/playwright/generate-sx-tests.py @@ -1881,6 +1881,14 @@ def js_expr_to_sx(expr): if m: return f'(host-get {m.group(1)} "{m.group(2)}")' + # JS keywords / literals + if expr in ('null', 'undefined'): + return 'nil' + if expr == 'true': + return 'true' + if expr == 'false': + return 'false' + # Bare identifier if re.match(r'^[A-Za-z_]\w*$', expr): return expr