HS: wait on event basics (+4 tests)
Five parts: (a) tests/hs-run-filtered.js `io-wait-event` mock now registers a one-shot listener on the target element and resumes with the event, instead of immediately resuming with nil. (b) Added hs-wait-for-or runtime form carrying a timeout-ms; mock resumes immediately when a timeout is present (0ms tests). (c) parser parse-wait-cmd recognises `wait for EV(v1, v2)` destructure syntax, emits :destructure list on wait-for AST. (d) compiler emit-wait-for updated for :from/:or combos; a new `__bind-from-detail__` form compiles to `(define v (host-get (host-get it "detail") v))`, and the `do`-sequence handler preprocesses wait-for to splice these synthetic bindings after the wait. (e) generator extracts `detail: ...` from `CustomEvent` options so dispatched events carry their payload. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13004,7 +13004,7 @@ end")
|
||||
(dom-append (dom-body) _el-div)
|
||||
(hs-activate! _el-div)
|
||||
(dom-dispatch _el-div "click" nil)
|
||||
(dom-dispatch _el-div "foo" nil)
|
||||
(dom-dispatch _el-div "foo" {:bar "bar"})
|
||||
(assert= (dom-text-content _el-div) "bar")
|
||||
))
|
||||
(deftest "can wait on event"
|
||||
@@ -13070,7 +13070,7 @@ end")
|
||||
(dom-append (dom-body) _el-div)
|
||||
(hs-activate! _el-div)
|
||||
(dom-dispatch _el-div "click" nil)
|
||||
(dom-dispatch _el-div "foo" nil)
|
||||
(dom-dispatch _el-div "foo" "hyperscript is hyper cool")
|
||||
(assert= (dom-text-content _el-div) "hyperscript is hyper cool")
|
||||
))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user