From e7b86264983efa4ebf7ae33542fcec15b7acdccc Mon Sep 17 00:00:00 2001
From: giles
Date: Thu, 23 Apr 2026 21:44:21 +0000
Subject: [PATCH] HS: some selector for nonempty match (+1 test)
`some ` compiles to (not (hs-falsy? (hs-query-first "html"))), which
called document.querySelector('html'). The mock's querySelector searched
only inside _body, so the html element wasn't found. Adjusted the mock to
return _html for the 'html' selector (and walk documentElement too).
Co-Authored-By: Claude Opus 4.7 (1M context)
---
tests/hs-run-filtered.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/hs-run-filtered.js b/tests/hs-run-filtered.js
index 4b44be5d..cf9d3433 100755
--- a/tests/hs-run-filtered.js
+++ b/tests/hs-run-filtered.js
@@ -274,7 +274,7 @@ const document = {
createDocumentFragment(){const f=new El('fragment');f.nodeType=11;return f;},
createTextNode(t){return{nodeType:3,textContent:t,data:t};},
getElementById(i){return fnd(_body,'#'+i);},
- querySelector(s){return fnd(_body,s);}, querySelectorAll(s){return fndAll(_body,s);},
+ querySelector(s){if(s==='html')return _html;if(s==='body')return _body;return fnd(_body,s)||(mt(_html,s)?_html:null);}, querySelectorAll(s){const r=fndAll(_body,s);if(s==='html'||mt(_html,s))r.unshift(_html);return r;},
createEvent(t){return new Ev(t);}, addEventListener(){}, removeEventListener(){},
};
globalThis.document=document; globalThis.window=globalThis; globalThis.HTMLElement=El; globalThis.Element=El;