;; 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: swap (4 tests — 0 runnable)"
    (p :style "color:#57534e;margin-bottom:1rem" "Live cards for the upstream swap tests. 0 of 4 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 swap two variables"
  :html "<div id='d1' _='on click set x to \"a\" then set y to \"b\" then swap x with y then put x + y into me'></div>"
  :action "find('#d1').dispatchEvent('click')"
  :check "toHaveText(\"ba\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can swap two properties"
  :html "<div id='d1' _='on click set #a.textContent to \"hello\" then set #b.textContent to \"world\" then swap #a.textContent with #b.textContent'></div>
			<span id='a'>x</span><span id='b'>y</span>"
  :action "find('#d1').dispatchEvent('click')"
  :check "toHaveText(\"world\"); toHaveText(\"hello\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can swap array elements"
  :html "<div id='d1' _='on click set arr to [1,2,3] then swap arr[0] with arr[2] then put arr as String into me'></div>"
  :action "find('#d1').dispatchEvent('click')"
  :check "toHaveText(\"3,2,1\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can swap a variable with a property"
  :html "<div id='d1' _='on click set x to \"old\" then set #target.dataset.val to \"new\" then swap x with #target.dataset.val then put x into me'></div>
			<span id='target' data-val='x'></span>"
  :action "find('#d1').dispatchEvent('click')"
  :check "toHaveText(\"new\"); toHaveAttribute('data-val', 'old')"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))"))))
