;; 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: morph (10 tests — 0 runnable)"
    (p :style "color:#57534e;margin-bottom:1rem" "Live cards for the upstream morph tests. 0 of 10 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 "basic morph updates content"
  :html "<div id='target'>old</div><button _='on click morph #target to \\\"<div id=target>new</div>\\\"'>go</button>"
  :action "find('button').dispatchEvent('click')"
  :check "toHaveText(\"new\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph preserves element identity"
  :html "<div id='target'>old</div><button id='go' _='on click morph #target to \\\"<div id=target>new</div>\\\"'>go</button>"
  :action "find('#go').dispatchEvent('click')"
  :check "toHaveText(\"new\"); toBe(true)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph updates attributes"
  :html "<div id='target' class='old'>content</div><button _='on click morph #target to \\\"<div id=target class=new>content</div>\\\"'>go</button>"
  :action "find('button').dispatchEvent('click')"
  :check "toHaveClass(\"new\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph adds new children"
  :html "<div id='target'><span>first</span></div><button id='go' _=\\\"on click morph #target to '<div id=target><span>first</span><span>second</span></div>'\\\">go</button>"
  :action "find('#go').dispatchEvent('click')"
  :check "toBe(2)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph removes old children"
  :html "<div id='target'><span>first</span><span>second</span></div><button id='go' _=\\\"on click morph #target to '<div id=target><span>first</span></div>'\\\">go</button>"
  :action "find('#go').dispatchEvent('click')"
  :check "toBe(1)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph initializes hyperscript on new elements"
  :html "<div id='target'><p>old</p></div><button id='go' _=\\\"on click morph #target to '<div id=target><p id=inner _=&#34;on click put `clicked` into me&#34;>new</p></div>'\\\">go</button>"
  :action "find('#go').dispatchEvent('click'); find('#inner').dispatchEvent('click')"
  :check "toHaveText(\"new\"); toHaveText(\"clicked\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph cleans up removed hyperscript elements"
  :html "<div id='target'>  <div id='child' _='on click put \\\"alive\\\" into me'>child</div></div><button _='on click morph #target to \\\"<div id=target><p>replaced</p></div>\\\"'>go</button>"
  :action "find('button').dispatchEvent('click')"
  :check ""
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph reorders children by id"
  :html "<div id='target'>  <div id='a'>A</div>  <div id='b'>B</div></div><button _='on click morph #target to \\\"<div id=target><div id=b>B2</div><div id=a>A2</div></div>\\\"'>go</button>"
  :action "find('button').dispatchEvent('click')"
  :check "toEqual([\"b\", \"a\"])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph preserves matched child identity"
  :html "<div id='target'><div id='child'>old</div></div><button id='go' _='on click morph #target to \\\"<div id=target><div id=child>new</div></div>\\\"'>go</button>"
  :action "find('#go').dispatchEvent('click')"
  :check "toBe(true); toBe(\"new\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "morph with variable content"
  :html "<div id='target'>original</div><button id='go' _='on click set content to \\\"<div id=target>morphed</div>\\\" then morph #target to content'>go</button>"
  :action "find('#go').dispatchEvent('click')"
  :check "toHaveText(\"morphed\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))"))))
