;; AUTO-GENERATED from spec/tests/hyperscript-upstream-tests.json
;; DO NOT EDIT — regenerate with:
;;   python3 tests/playwright/generate-sx-tests.py --emit-pages

(defcomp ()
  (~docs/page :title "Hyperscript: put (38 tests — 35 runnable)"
    (p :style "color:#57534e;margin-bottom:1rem" "Live cards for the upstream put tests. 35 of 38 are reproducible in-browser; the remainder show their source for reference.")
    (p :style "color:#78716c;font-size:0.875rem;margin-bottom:1rem"
      "Theme: " (a :href "/sx/(applications.(hyperscript.gallery-dom))"
        :style "color:#7c3aed" "dom"))
    (div :style "display:flex;flex-direction:column"
      (~hyperscript/hs-test-card
  :name "can set properties"
  :html "<div id='d1' _='on click put \"foo\" into #d1.innerHTML'></div>"
  :action "d1.click()"
  :check "d1.innerHTML.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"foo\\\" into #d1.innerHTML\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can put directly into nodes"
  :html "<div id='d1' _='on click put \"foo\" into #d1'></div>"
  :action "d1.click()"
  :check "d1.textContent.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"foo\\\" into #d1\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-text-content _el-d1) \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can put nodes into nodes"
  :html "<div id='d1'></div> | <div id='d2' _='on click put #d1 into #d2'></div>"
  :action "d2.click()"
  :check "d2.firstChild.should.equal(d1)"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")) (_el-d2 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d2 \"id\" \"d2\")
    (dom-set-attr _el-d2 \"_\" \"on click put #d1 into #d2\")
    (dom-append sandbox _el-d1)
    (dom-append sandbox _el-d2)
    (hs-activate! _el-d2)
    (dom-dispatch _el-d2 \"click\" nil)
    ;; SKIP check: skip d2.firstChild.should.equal(d1)
  ))")
(~hyperscript/hs-test-card
  :name "can put directly into symbols"
  :html "<div _='on click put \"foo\" into me'></div>"
  :action "d1.click()"
  :check "d1.innerHTML.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click put \\\"foo\\\" into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "me symbol doesn't get stomped on direct write"
  :html "<div _='on click put \"foo\" into me then put \"bar\" into me'></div>"
  :action "d1.click()"
  :check "d1.innerHTML.should.equal(\"bar\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click put \\\"foo\\\" into me then put \\\"bar\\\" into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"bar\")
  ))")
(~hyperscript/hs-test-card
  :name "can set styles"
  :html "<div _='on click put \"red\" into my.style.color'>lolwat</div>"
  :action "d1.click()"
  :check "d1.style.color.should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click put \\\"red\\\" into my.style.color\")
    (dom-set-inner-html _el-div \"lolwat\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-style _el-div \"color\") \"red\")
  ))")
(~hyperscript/hs-test-card
  :name "can set javascript globals"
  :html "<div _='on click put \"red\" into window.temp'>lolwat</div>"
  :action "d1.click()"
  :check "window[\"temp\"].should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click put \\\"red\\\" into window.temp\")
    (dom-set-inner-html _el-div \"lolwat\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    ;; SKIP check: skip window[\"temp\"].should.equal(\"red\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into class ref w/ flatmapped property"
  :html "<div _='on click put \"foo\" into .divs.parentElement.innerHTML'></div> | <div id='d1'><div class='divs'></div></div><div id='d2'><div class='divs'></div></div>"
  :action "div.click()"
  :check "d1.textContent.should.equal(\"foo\") && d2.textContent.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")) (_el-d1 (dom-create-element \"div\")) (_el-div2 (dom-create-element \"div\")) (_el-d2 (dom-create-element \"div\")) (_el-div4 (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click put \\\"foo\\\" into .divs.parentElement.innerHTML\")
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-add-class _el-div2 \"divs\")
    (dom-set-attr _el-d2 \"id\" \"d2\")
    (dom-add-class _el-div4 \"divs\")
    (dom-append sandbox _el-div)
    (dom-append sandbox _el-d1)
    (dom-append _el-d1 _el-div2)
    (dom-append sandbox _el-d2)
    (dom-append _el-d2 _el-div4)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-text-content _el-d1) \"foo\")
    (assert= (dom-text-content _el-d2) \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into class ref w/ flatmapped property using of"
  :html "<div _='on click put \"foo\" into innerHTML of parentElement of .divs'></div> | <div id='d1'><div class='divs'></div></div><div id='d2'><div class='divs'></div></div>"
  :action "div.click()"
  :check "d1.textContent.should.equal(\"foo\") && d2.textContent.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")) (_el-d1 (dom-create-element \"div\")) (_el-div2 (dom-create-element \"div\")) (_el-d2 (dom-create-element \"div\")) (_el-div4 (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click put \\\"foo\\\" into innerHTML of parentElement of .divs\")
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-add-class _el-div2 \"divs\")
    (dom-set-attr _el-d2 \"id\" \"d2\")
    (dom-add-class _el-div4 \"divs\")
    (dom-append sandbox _el-div)
    (dom-append sandbox _el-d1)
    (dom-append _el-d1 _el-div2)
    (dom-append sandbox _el-d2)
    (dom-append _el-d2 _el-div4)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-text-content _el-d1) \"foo\")
    (assert= (dom-text-content _el-d2) \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can set local variables"
  :html "<div id='d1' _='on click put \"foo\" into newVar then                                    put newVar into #d1.innerHTML'></div>"
  :action "d1.click()"
  :check "d1.innerHTML.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"foo\\\" into newVar then put newVar into #d1.innerHTML\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into id ref"
  :html "<div id='d1' _='on click put \"foo\" into #d1.innerHTML'></div>"
  :action "d1.click()"
  :check "d1.innerHTML.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"foo\\\" into #d1.innerHTML\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can insert before"
  :html "<div id='d2' _='on click put #d1 before #d2'></div> | <div id='d1'>foo</div>"
  :action "d2.click()"
  :check "d2.previousSibling.textContent.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-d2 (dom-create-element \"div\")) (_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d2 \"id\" \"d2\")
    (dom-set-attr _el-d2 \"_\" \"on click put #d1 before #d2\")
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-inner-html _el-d1 \"foo\")
    (dom-append sandbox _el-d2)
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d2)
    (dom-dispatch _el-d2 \"click\" nil)
    ;; SKIP check: skip d2.previousSibling.textContent.should.equal(\"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can insert after"
  :html "<div id='d1'>foo</div> | <div id='d2' _='on click put #d1 after #d2'></div>"
  :action "d2.click()"
  :check "d2.nextSibling.textContent.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")) (_el-d2 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-inner-html _el-d1 \"foo\")
    (dom-set-attr _el-d2 \"id\" \"d2\")
    (dom-set-attr _el-d2 \"_\" \"on click put #d1 after #d2\")
    (dom-append sandbox _el-d1)
    (dom-append sandbox _el-d2)
    (hs-activate! _el-d2)
    (dom-dispatch _el-d2 \"click\" nil)
    ;; SKIP check: skip d2.nextSibling.textContent.should.equal(\"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can insert after beginning"
  :html "<div id='d1' _='on click put \"foo\" at start of #d1'>*</div>"
  :action "d1.click()"
  :check "d1.textContent.should.equal(\"foo*\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"foo\\\" at start of #d1\")
    (dom-set-inner-html _el-d1 \"*\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-text-content _el-d1) \"foo*\")
  ))")
(~hyperscript/hs-test-card
  :name "can insert before end"
  :html "<div id='d1' _='on click put \"foo\" at end of #d1'>*</div>"
  :action "d1.click()"
  :check "d1.textContent.should.equal(\"*foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"foo\\\" at end of #d1\")
    (dom-set-inner-html _el-d1 \"*\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-text-content _el-d1) \"*foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into attribute ref"
  :html "<div class='divs' _='on click put \"foo\" into @bar'></div>"
  :action "d1.click()"
  :check "d1.getAttribute(\"bar\").should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put \\\"foo\\\" into @bar\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-attr _el-div \"bar\") \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into indirect attribute ref"
  :html "<div class='divs' _='on click put \"foo\" into my @bar'></div>"
  :action "d1.click()"
  :check "d1.getAttribute(\"bar\").should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put \\\"foo\\\" into my @bar\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-attr _el-div \"bar\") \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into indirect attribute ref 2"
  :html "<div class='divs' _=\"on click put 'foo' into #div2's @bar\"></div> | <div id='div2'></div>"
  :action "d1.click()"
  :check "d2.getAttribute(\"bar\").should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")) (_el-div2 (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put 'foo' into #div2's @bar\")
    (dom-set-attr _el-div2 \"id\" \"div2\")
    (dom-append sandbox _el-div)
    (dom-append sandbox _el-div2)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-attr _el-div2 \"bar\") \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into indirect attribute ref 3"
  :html "<div class='divs' _=\"on click put 'foo' into @bar of #div2\"></div> | <div id='div2'></div>"
  :action "d1.click()"
  :check "d2.getAttribute(\"bar\").should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")) (_el-div2 (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put 'foo' into @bar of #div2\")
    (dom-set-attr _el-div2 \"id\" \"div2\")
    (dom-append sandbox _el-div)
    (dom-append sandbox _el-div2)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-attr _el-div2 \"bar\") \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into style ref"
  :html "<div class='divs' _='on click put \"red\" into *color'></div>"
  :action "d1.click()"
  :check "d1.style[\"color\"].should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put \\\"red\\\" into *color\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    ;; SKIP check: skip d1.style[\"color\"].should.equal(\"red\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into indirect style ref"
  :html "<div class='divs' _='on click put \"red\" into my *color'></div>"
  :action "d1.click()"
  :check "d1.style[\"color\"].should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put \\\"red\\\" into my *color\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    ;; SKIP check: skip d1.style[\"color\"].should.equal(\"red\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into indirect style ref 2"
  :html "<div class='divs' _=\"on click put 'red' into #div2's *color\"></div> | <div id='div2'></div>"
  :action "d1.click()"
  :check "d2.style[\"color\"].should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")) (_el-div2 (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put 'red' into #div2's *color\")
    (dom-set-attr _el-div2 \"id\" \"div2\")
    (dom-append sandbox _el-div)
    (dom-append sandbox _el-div2)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    ;; SKIP check: skip d2.style[\"color\"].should.equal(\"red\")
  ))")
(~hyperscript/hs-test-card
  :name "can set into indirect style ref 3"
  :html "<div class='divs' _=\"on click put 'red' into the *color of #div2\"></div> | <div id='div2'></div>"
  :action "d1.click()"
  :check "d2.style[\"color\"].should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")) (_el-div2 (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put 'red' into the *color of #div2\")
    (dom-set-attr _el-div2 \"id\" \"div2\")
    (dom-append sandbox _el-div)
    (dom-append sandbox _el-div2)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    ;; SKIP check: skip d2.style[\"color\"].should.equal(\"red\")
  ))")
(~hyperscript/hs-test-card
  :name "waits on promises"
  :html "<div id='d1' _='on click put promiseAString() into #d1.innerHTML'></div>"
  :action "d1.click()"
  :check "d1.innerHTML.should.equal(\"\") && d1.innerHTML.should.equal(\"foo\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put promiseAString() into #d1.innerHTML\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"foo\")
  ))")
(~hyperscript/hs-test-card
  :name "can put properties w/ array access syntax"
  :html "<div _='on click put \"red\" into my style[\"color\"]'>lolwat</div>"
  :action "d1.click()"
  :check "d1.style.color.should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click put \\\"red\\\" into my style[\\\"color\\\"]\")
    (dom-set-inner-html _el-div \"lolwat\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-style _el-div \"color\") \"red\")
  ))")
(~hyperscript/hs-test-card
  :name "can put properties w/ array access syntax and var"
  :html "<div _='on click set foo to \"color\" then put \"red\" into my style[foo]'>lolwat</div>"
  :action "d1.click()"
  :check "d1.style.color.should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set foo to \\\"color\\\" then put \\\"red\\\" into my style[foo]\")
    (dom-set-inner-html _el-div \"lolwat\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-style _el-div \"color\") \"red\")
  ))")
(~hyperscript/hs-test-card
  :name "can put array vals w/ array access syntax"
  :html "<div _='on click set arr to [1, 2, 3] put \"red\" into arr[0] put arr[0] into my *color'>lolwat</div>"
  :action "d1.click()"
  :check "d1.style.color.should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set arr to [1, 2, 3] put \\\"red\\\" into arr[0] put arr[0] into my *color\")
    (dom-set-inner-html _el-div \"lolwat\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-style _el-div \"color\") \"red\")
  ))")
(~hyperscript/hs-test-card
  :name "can put array vals w/ array access syntax and var"
  :html "<div _='on click set arr to [1, 2, 3] set idx to 0 put \"red\" into arr[idx] put arr[0] into my *color'>lolwat</div>"
  :action "d1.click()"
  :check "d1.style.color.should.equal(\"red\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set arr to [1, 2, 3] set idx to 0 put \\\"red\\\" into arr[idx] put arr[0] into my *color\")
    (dom-set-inner-html _el-div \"lolwat\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-get-style _el-div \"color\") \"red\")
  ))")
(~hyperscript/hs-test-card
  :name "properly processes hyperscript in new content in a symbol write"
  :html "<div _='on click put \"<button id=\\\\\"b1\\\\\" _=\\\\\"on click put 42 into me\\\\\">40</button>\" into me'></div>"
  :action "div.click(); button.click()"
  :check "button.innerHTML.should.equal(\"40\") && button.innerHTML.should.equal(\"42\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click put \\\"<button id=\\\\\\\"b1\\\\\\\" _=\\\\\\\"on click put 42 into me\\\\\\\">40</button>\\\" into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"42\")
  ))")
(~hyperscript/hs-test-card
  :name "properly processes hyperscript in new content in a element target"
  :html "<div id='d1' _='on click put \"<button id=\\\\\"b1\\\\\" _=\\\\\"on click put 42 into me\\\\\">40</button>\" into <div#d1/>'></div>"
  :action "div.click(); button.click()"
  :check "button.innerHTML.should.equal(\"40\") && button.innerHTML.should.equal(\"42\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"<button id=\\\\\\\"b1\\\\\\\" _=\\\\\\\"on click put 42 into me\\\\\\\">40</button>\\\" into <div#d1/>\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"42\")
  ))")
(~hyperscript/hs-test-card
  :name "properly processes hyperscript in before"
  :html "<div id='d1' _='on click put \"<button id=\\\\\"b1\\\\\" _=\\\\\"on click put 42 into me\\\\\">40</button>\" before me'></div>"
  :action "div.click(); button.click()"
  :check "button.innerHTML.should.equal(\"40\") && button.innerHTML.should.equal(\"42\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"<button id=\\\\\\\"b1\\\\\\\" _=\\\\\\\"on click put 42 into me\\\\\\\">40</button>\\\" before me\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"42\")
  ))")
(~hyperscript/hs-test-card
  :name "properly processes hyperscript at start of"
  :html "<div id='d1' _='on click put \"<button id=\\\\\"b1\\\\\" _=\\\\\"on click put 42 into me\\\\\">40</button>\" at the start of me'></div>"
  :action "div.click(); button.click()"
  :check "button.innerHTML.should.equal(\"40\") && button.innerHTML.should.equal(\"42\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"<button id=\\\\\\\"b1\\\\\\\" _=\\\\\\\"on click put 42 into me\\\\\\\">40</button>\\\" at the start of me\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"42\")
  ))")
(~hyperscript/hs-test-card
  :name "properly processes hyperscript at end of"
  :html "<div id='d1' _='on click put \"<button id=\\\\\"b1\\\\\" _=\\\\\"on click put 42 into me\\\\\">40</button>\" at the end of me'></div>"
  :action "div.click(); button.click()"
  :check "button.innerHTML.should.equal(\"40\") && button.innerHTML.should.equal(\"42\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"<button id=\\\\\\\"b1\\\\\\\" _=\\\\\\\"on click put 42 into me\\\\\\\">40</button>\\\" at the end of me\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"42\")
  ))")
(~hyperscript/hs-test-card
  :name "properly processes hyperscript after"
  :html "<div id='d1' _='on click put \"<button id=\\\\\"b1\\\\\" _=\\\\\"on click put 42 into me\\\\\">40</button>\" after me'></div>"
  :action "div.click(); button.click()"
  :check "button.innerHTML.should.equal(\"40\") && button.innerHTML.should.equal(\"42\")"
  :run-src "(fn (sandbox)
  (let ((_el-d1 (dom-create-element \"div\")))
    (dom-set-attr _el-d1 \"id\" \"d1\")
    (dom-set-attr _el-d1 \"_\" \"on click put \\\"<button id=\\\\\\\"b1\\\\\\\" _=\\\\\\\"on click put 42 into me\\\\\\\">40</button>\\\" after me\")
    (dom-append sandbox _el-d1)
    (hs-activate! _el-d1)
    (dom-dispatch _el-d1 \"click\" nil)
    (dom-dispatch _el-d1 \"click\" nil)
    (assert= (dom-inner-html _el-d1) \"42\")
  ))")
(~hyperscript/hs-test-card
  :name "is null tolerant"
  :html "<div class='divs' _='on click put \"red\" into #a-bad-id-that-does-not-exist'></div>"
  :action "d1.click()"
  :check "(no explicit assertion)"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-add-class _el-div \"divs\")
    (dom-set-attr _el-div \"_\" \"on click put \\\"red\\\" into #a-bad-id-that-does-not-exist\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
  ))")
(~hyperscript/hs-test-card
  :name "put null into attribute removes it"
  :html "<div id='d1' foo='bar' _='on click put null into @foo'></div>"
  :action "find('#d1').dispatchEvent('click')"
  :check "toHaveAttribute('foo', 'bar'); toHaveAttribute('foo')"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can put at start of an array"
  :html "<div _=\"on click
		                      set :arr to [2,3]
		                      put 1 at start of :arr
		                      put :arr as String into me\"></div>"
  :action "find('div').dispatchEvent('click')"
  :check "toHaveText(\"1,2,3\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can put at end of an array"
  :html "<div _=\"on click
		                      set :arr to [1,2]
		                      put 3 at end of :arr
		                      put :arr as String into me\"></div>"
  :action "find('div').dispatchEvent('click')"
  :check "toHaveText(\"1,2,3\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))"))))
