HS: logAll config (+1 test)
Add `_hs-config-log-all` runtime flag + captured log list. When set via `hs-set-log-all!`, `hs-activate!` pushes "hyperscript:init" onto `_hs-log-captured` and mirrors to console.log. Covers cluster 30. Generator side: eval-only path now detects the logAll body pattern (`_hyperscript.config.logAll = true`) and emits a deftest that: - resets captured list - toggles log-all on - builds a div with `_="on click add .foo"` and `hs-boot-subtree!`s - asserts `(some string-contains? "hyperscript:")` over captured logs. hs-upstream-core/bootstrap: 19/26 -> 20/26. Smoke 0-195: 164 -> 165.
This commit is contained in:
@@ -1771,6 +1771,27 @@ def generate_eval_only_test(test, idx):
|
||||
body = test.get('body', '')
|
||||
lines = []
|
||||
safe_name = sx_name(test['name'])
|
||||
|
||||
# Special case: logAll config test. Body sets `_hyperscript.config.logAll = true`,
|
||||
# then mutates an element's innerHTML and calls `_hyperscript.processNode`.
|
||||
# Our runtime exposes this via hs-set-log-all! + hs-log-captured; we reuse
|
||||
# the same mechanics without re-parsing the body.
|
||||
if 'logAll' in body and '_hyperscript.config.logAll' in body:
|
||||
return (
|
||||
f' (deftest "{safe_name}"\n'
|
||||
f' (hs-cleanup!)\n'
|
||||
f' (hs-clear-log-captured!)\n'
|
||||
f' (hs-set-log-all! true)\n'
|
||||
f' (let ((wa (dom-create-element "div")))\n'
|
||||
f' (dom-set-inner-html wa "<div _=\\"on click add .foo\\"></div>")\n'
|
||||
f' (hs-boot-subtree! wa))\n'
|
||||
f' (hs-set-log-all! false)\n'
|
||||
f' (assert= (some (fn (l) (string-contains? l "hyperscript:"))\n'
|
||||
f' (hs-get-log-captured))\n'
|
||||
f' true)\n'
|
||||
f' )'
|
||||
)
|
||||
|
||||
lines.append(f' (deftest "{safe_name}"')
|
||||
|
||||
assertions = []
|
||||
|
||||
Reference in New Issue
Block a user