;; 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: increment (20 tests — 15 runnable)"
    (p :style "color:#57534e;margin-bottom:1rem" "Live cards for the upstream increment tests. 15 of 20 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-expressions))"
        :style "color:#7c3aed" "expressions"))
    (div :style "display:flex;flex-direction:column"
      (~hyperscript/hs-test-card
  :name "can increment an empty variable"
  :html "<div _=\"on click increment value then put value into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"1\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click increment value then put value into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"1\")
  ))")
(~hyperscript/hs-test-card
  :name "can increment a variable"
  :html "<div _=\"on click set value to 20 then increment value by 2 then put value into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"22\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set value to 20 then increment value by 2 then put value into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"22\")
  ))")
(~hyperscript/hs-test-card
  :name "can increment refer to result"
  :html "<div _=\"on click increment value by 2 then put it into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"2\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click increment value by 2 then put it into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"2\")
  ))")
(~hyperscript/hs-test-card
  :name "can increment an attribute"
  :html "<div value=\"5\" _=\"on click increment @value then put @value into me\"></div>"
  :action "div.click(); div.click(); div.click()"
  :check "div.innerHTML.should.equal(\"8\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click increment @value then put @value into me\")
    (dom-set-attr _el-div \"value\" \"5\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"8\")
  ))")
(~hyperscript/hs-test-card
  :name "can increment an floating point numbers"
  :html "<div value=\"5\" _=\"on click set value to 5.2 then increment value by 6.1 then put value into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"11.3\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set value to 5.2 then increment value by 6.1 then put value into me\")
    (dom-set-attr _el-div \"value\" \"5\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"11.3\")
  ))")
(~hyperscript/hs-test-card
  :name "can increment a property"
  :html "<div _=\"on click increment my.innerHTML\">3</div>"
  :action "div.click(); div.click(); div.click()"
  :check "div.innerHTML.should.equal(\"6\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click increment my.innerHTML\")
    (dom-set-inner-html _el-div \"3\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"6\")
  ))")
(~hyperscript/hs-test-card
  :name "can increment by zero"
  :html "<div _=\"on click set value to 20 then increment value by 0 then put value into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"20\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set value to 20 then increment value by 0 then put value into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"20\")
  ))")
(~hyperscript/hs-test-card
  :name "can increment a value multiple times"
  :html "<div _=\"on click increment my.innerHTML\"></div>"
  :action "div.click(); div.click(); div.click(); div.click(); div.click()"
  :check "div.innerHTML.should.equal(\"5\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click increment my.innerHTML\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"5\")
  ))")
(~hyperscript/hs-test-card
  :name "can decrement an empty variable"
  :html "<div _=\"on click decrement value then put value into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"-1\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click decrement value then put value into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"-1\")
  ))")
(~hyperscript/hs-test-card
  :name "can decrement a variable"
  :html "<div _=\"on click set value to 20 then decrement value by 2 then put value into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"18\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set value to 20 then decrement value by 2 then put value into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"18\")
  ))")
(~hyperscript/hs-test-card
  :name "can decrement an attribute"
  :html "<div value=\"5\" _=\"on click decrement @value then put @value into me\"></div>"
  :action "div.click(); div.click(); div.click()"
  :check "div.innerHTML.should.equal(\"2\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click decrement @value then put @value into me\")
    (dom-set-attr _el-div \"value\" \"5\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"2\")
  ))")
(~hyperscript/hs-test-card
  :name "can decrement an floating point numbers"
  :html "<div value=\"5\" _=\"on click set value to 6.1 then decrement value by 5.1 then put value into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"1\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set value to 6.1 then decrement value by 5.1 then put value into me\")
    (dom-set-attr _el-div \"value\" \"5\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"1\")
  ))")
(~hyperscript/hs-test-card
  :name "can decrement a property"
  :html "<div _=\"on click decrement my.innerHTML\">3</div>"
  :action "div.click(); div.click(); div.click()"
  :check "div.innerHTML.should.equal(\"0\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click decrement my.innerHTML\")
    (dom-set-inner-html _el-div \"3\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"0\")
  ))")
(~hyperscript/hs-test-card
  :name "can decrement a value multiple times"
  :html "<div _=\"on click decrement my.innerHTML\"></div>"
  :action "div.click(); div.click(); div.click(); div.click(); div.click()"
  :check "div.innerHTML.should.equal(\"-5\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click decrement my.innerHTML\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"-5\")
  ))")
(~hyperscript/hs-test-card
  :name "can decrement by zero"
  :html "<div _=\"on click set value to 20 then decrement value by 0 then put value into me\"></div>"
  :action "div.click()"
  :check "div.innerHTML.should.equal(\"20\")"
  :run-src "(fn (sandbox)
  (let ((_el-div (dom-create-element \"div\")))
    (dom-set-attr _el-div \"_\" \"on click set value to 20 then decrement value by 0 then put value into me\")
    (dom-append sandbox _el-div)
    (hs-activate! _el-div)
    (dom-dispatch _el-div \"click\" nil)
    (assert= (dom-inner-html _el-div) \"20\")
  ))")
(~hyperscript/hs-test-card
  :name "can increment an array element"
  :html "<div _=\"on click set arr to [10, 20, 30] then increment arr[1] then put arr[1] into me\"></div>"
  :action "find('div').dispatchEvent('click')"
  :check "toHaveText(\"21\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can decrement an array element"
  :html "<div _=\"on click set arr to [10, 20, 30] then decrement arr[1] then put arr[1] into me\"></div>"
  :action "find('div').dispatchEvent('click')"
  :check "toHaveText(\"19\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can increment a possessive property"
  :html "<div id=\"d1\" _=\"on click increment #d1's innerHTML\">5</div>"
  :action "find('#d1').dispatchEvent('click')"
  :check "toHaveText(\"6\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can increment a property of expression"
  :html "<div id=\"d1\" _=\"on click increment innerHTML of #d1\">5</div>"
  :action "find('#d1').dispatchEvent('click')"
  :check "toHaveText(\"6\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "can increment a style ref"
  :html "<div _=\"on click set my *opacity to 0.5 then increment *opacity by 0.25 then put *opacity into me\"></div>"
  :action "find('div').dispatchEvent('click')"
  :check "toHaveText(\"0.75\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))"))))
