;; 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: bootstrap (14 tests — 3 runnable)"
    (p :style "color:#57534e;margin-bottom:1rem" "Live cards for the upstream bootstrap tests. 3 of 14 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-events))"
        :style "color:#7c3aed" "events"))
    (div :style "display:flex;flex-direction:column"
      (~hyperscript/hs-test-card
  :name "hyperscript can have more than one action"
  :html "<div id='bar'></div><div _='on click                              add .foo to #bar then                              add .blah'></div>"
  :action ""
  :check "toHaveClass(/foo/); toHaveClass(/blah/)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "stores state on elt._hyperscript"
  :html "<div _='on click add .foo'></div>"
  :action ""
  :check "toBe(true); toBe(true); toBe(true)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "skips reinitialization if script unchanged"
  :html "<div _='on click add .foo'></div>"
  :action "evaluate({...}); div.click()"
  :check "toBe(1)"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click add .foo\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    ;; SKIP action: evaluate__...__
    (dom-dispatch _el-div \"click\" nil)
    ;; SKIP check: skip toBe(1)
  ))")
(~hyperscript/hs-test-card
  :name "reinitializes if script attribute changes"
  :html "<div _='on click add .foo'></div>"
  :action "find('div').dispatchEvent('click'); find('div').dispatchEvent('click'); evaluate({...})"
  :check "toHaveClass(/foo/); toHaveClass(/bar/)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "cleanup removes event listeners on the element"
  :html "<div _='on click add .foo'></div>"
  :action "find('div').dispatchEvent('click'); evaluate({...}); div.click()"
  :check "toHaveClass(/foo/); toHaveClass(/foo/)"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click add .foo\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    ;; SKIP action: find__div__.dispatchEvent__click__
    ;; SKIP action: evaluate__...__
    (dom-dispatch _el-div \"click\" nil)
    ;; SKIP check: skip toHaveClass(/foo/); toHaveClass(/foo/)
  ))")
(~hyperscript/hs-test-card
  :name "cleanup removes cross-element event listeners"
  :html "<div id='source'></div><div id='target' _='on click from #source add .foo'></div>"
  :action "find('#source').dispatchEvent('click'); evaluate({...}); source.click()"
  :check "toHaveClass(/foo/); toBe(true)"
  :run-src "(fn (sandbox)
  (let ((_el-source (dom-create-element \"div\")) (_el-target (dom-create-element \"div\")))
    (dom-set-attr _el-source \"id\" \"source\")
    (dom-set-attr _el-target \"id\" \"target\")
    (dom-set-attr _el-target \"_\" \"on click from #source add .foo\")
    (dom-append sandbox _el-source)
    (dom-append sandbox _el-target)
    (hs-activate! _el-target)
    ;; SKIP action: find___source__.dispatchEvent__click__
    ;; SKIP action: evaluate__...__
    (dom-dispatch _el-source \"click\" nil)
    ;; SKIP check: skip toHaveClass(/foo/); toBe(true)
  ))")
(~hyperscript/hs-test-card
  :name "cleanup tracks listeners in elt._hyperscript"
  :html "<div _='on click add .foo'></div>"
  :action ""
  :check "toBe(true)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "cleanup clears elt._hyperscript"
  :html "<div _='on click add .foo'></div>"
  :action ""
  :check "toBe(false)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "sets data-hyperscript-powered on initialized elements"
  :html "<div _='on click add .foo'></div>"
  :action ""
  :check "toHaveAttribute('data-hyperscript-powered', 'true')"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "cleanup removes data-hyperscript-powered"
  :html "<div _='on click add .foo'></div>"
  :action ""
  :check "toHaveAttribute('data-hyperscript-powered', 'true')"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "fires hyperscript:before:init and hyperscript:after:init"
  :html ""
  :action "evaluate({...})"
  :check "toEqual(['before:init', 'after:init'])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "hyperscript:before:init can cancel initialization"
  :html ""
  :action ""
  :check "toBe(false); toBe(false)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "fires hyperscript:before:cleanup and hyperscript:after:cleanup"
  :html "<div _='on click add .foo'></div>"
  :action ""
  :check "toEqual(['before:cleanup', 'after:cleanup'])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "logAll config logs events to console"
  :html ""
  :action "evaluate({...})"
  :check "toBe(true)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))"))))
