HS: fix as Values SELECT + multi-select programmatic changes
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 18s
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:
@@ -3817,11 +3817,15 @@
|
||||
)
|
||||
(deftest "converts multiple selects with programmatically changed selections"
|
||||
(let ((_node (dom-create-element "form")))
|
||||
(dom-set-inner-html _node "<select name=\"animal\" multiple> <option value=\"dog\" selected>Doggo</option> <option value=\"cat\">Kitteh</option> <option value=\"raccoon\" selected>Trash Panda</option> <option value=\"possum\">Sleepy Boi</option> </select>")
|
||||
(let ((_result (eval-hs-locals "x as Values" (list (list (quote x) _node)))))
|
||||
(assert= (nth (host-get _result "animal") 0) "cat")
|
||||
(assert= (nth (host-get _result "animal") 1) "raccoon")
|
||||
))
|
||||
(dom-set-inner-html _node "<select name="animal" multiple> <option value="dog" selected>Doggo</option> <option value="cat">Kitteh</option> <option value="raccoon" selected>Trash Panda</option> <option value="possum">Sleepy Boi</option> </select>")
|
||||
(let ((_sel (dom-query _node "select")))
|
||||
(let ((_opts (host-get _sel "options")))
|
||||
(host-set! (nth _opts 0) "selected" false)
|
||||
(host-set! (nth _opts 1) "selected" true)
|
||||
(let ((_result (eval-hs-locals "x as Values" (list (list (quote x) _node)))))
|
||||
(assert= (nth (host-get _result "animal") 0) "cat")
|
||||
(assert= (nth (host-get _result "animal") 1) "raccoon")
|
||||
))))
|
||||
)
|
||||
(deftest "converts nested array as Flat"
|
||||
(assert= (eval-hs "[[1,2],[3,4]] as Flat") (list 1 2 3 4))
|
||||
|
||||
Reference in New Issue
Block a user