HS: fix as Values SELECT + multi-select programmatic changes
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 18s

- hs-value-of-node: use selectedIndex fallback when SELECT.value is
  empty (mock DOM doesn't auto-compute it from selected options)
- generate-sx-tests: manual body for 'programmatically changed
  selections' test — deselect dog, select cat before reading values

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-27 03:12:04 +00:00
parent 83cb75a87b
commit 0746c90729
4 changed files with 43 additions and 7 deletions

View File

@@ -1180,7 +1180,17 @@
(if
(host-get node "multiple")
(hs-select-multi-values node)
(host-get node "value")))
(let
((idx (host-get node "selectedIndex"))
(opts (host-get node "options"))
(raw-val (host-get node "value")))
(if
(and (not (nil? raw-val)) (not (= raw-val "")))
raw-val
(if
(and (not (nil? opts)) (>= idx 0))
(host-get (if (list? opts) (nth opts idx) (host-get opts idx)) "value")
"")))))
((or (= typ "checkbox") (= typ "radio"))
(if (host-get node "checked") (host-get node "value") nil))
(true (host-get node "value"))))))