HS: toggle multi-class + until event (+2 tests)
Parser `parse-toggle-cmd`: after the leading class ref, collect any additional class refs and treat `toggle .foo .bar` as `toggle-between` (pair-only). Recognise a `until EVENT [from SOURCE]` modifier and emit a new `toggle-class-until` AST node. Compiler handles the new node by emitting `(begin (hs-toggle-class! tgt cls) (hs-wait-for src ev) (hs-toggle-class! tgt cls))` which uses the existing event-waiter machinery to flip the class back when the specified event fires. Remaining toggle test (`can toggle for a fixed amount of time`) depends on the mock's sync io-sleep resuming immediately — the click handler toggles on/off synchronously, so the pre-timeout assertion can never see the `.foo` class present. Needs an async scheduler in the mock to handle. Suite hs-upstream-toggle: 22/25 → 24/25. Smoke 0-195: 162/195 unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1426,6 +1426,20 @@
|
||||
(quote hs-toggle-class!)
|
||||
(hs-to-sx (nth ast 2))
|
||||
(nth ast 1))))
|
||||
((= head (quote toggle-class-until))
|
||||
(let
|
||||
((cls (nth ast 1))
|
||||
(tgt (hs-to-sx (nth ast 2)))
|
||||
(event-name (nth ast 3))
|
||||
(source (nth ast 4)))
|
||||
(list
|
||||
(quote do)
|
||||
(list (quote hs-toggle-class!) tgt cls)
|
||||
(list
|
||||
(quote hs-wait-for)
|
||||
(if source (hs-to-sx source) (quote me))
|
||||
event-name)
|
||||
(list (quote hs-toggle-class!) tgt cls))))
|
||||
((= head (quote set-on))
|
||||
(list
|
||||
(quote hs-set-on!)
|
||||
|
||||
Reference in New Issue
Block a user