;; 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: collectionExpressions (22 tests — 0 runnable)"
    (p :style "color:#57534e;margin-bottom:1rem" "Live cards for the upstream collectionExpressions tests. 0 of 22 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 "filters an array by condition"
  :html ""
  :action ""
  :check ""
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "filters with comparison"
  :html ""
  :action ""
  :check "toEqual([4, 5])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "works with DOM elements"
  :html "<ul id='list'><li class='yes'>A</li><li>B</li><li class='yes'>C</li></ul><button _='on click set items to <li/> in #list then set matches to items where it matches .yes then put matches mapped to its textContent into #out'>Go</button><div id='out'></div>"
  :action "find('button').click()"
  :check "toHaveText(\"AC\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "sorts by a property"
  :html ""
  :action ""
  :check ""
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "sorts descending"
  :html ""
  :action ""
  :check "toEqual([3, 2, 1])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "sorts numbers by a computed key"
  :html ""
  :action ""
  :check ""
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "maps to a property"
  :html ""
  :action ""
  :check "toEqual([\"Alice\", \"Bob\"])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "maps with an expression"
  :html ""
  :action ""
  :check "toEqual([2, 4, 6])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where then mapped to"
  :html ""
  :action ""
  :check "toEqual([\"Alice\", \"Charlie\"])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "sorted by then mapped to"
  :html ""
  :action ""
  :check "toEqual([\"Alice\", \"Charlie\"])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where then sorted by then mapped to"
  :html ""
  :action ""
  :check "toEqual([\"Bob\", \"Charlie\"])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "the result inside where refers to previous command result, not current element"
  :html ""
  :action ""
  :check "toEqual([4, 5])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where binds after in without parens"
  :html "<div id='container'><span class='a'>A</span><span class='b'>B</span><span class='a'>C</span></div>"
  :action "await run(\"<span/> in #container where it matches .a\""
  :check "toBe(2)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "sorted by binds after in without parens"
  :html "<ul id='list'><li>C</li><li>A</li><li>B</li></ul>"
  :action "await run(\"<li/> in #list where its textContent is not '"
  :check "toBe(2)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where binds after property access"
  :html ""
  :action "await run(\"obj.items where it > 2\""
  :check "toEqual([3, 4])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where after in with mapped to"
  :html "<ul id='items'><li class='yes'>A</li><li>B</li><li class='yes'>C</li></ul>"
  :action "await run(
			\"<li/> in #items where it matches .yes mapped to its textContent\""
  :check "toEqual([\"A\", \"C\"])"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where binds after in on closest"
  :html "<div id='box'><span class='a'>A</span><span class='b'>B</span><span class='a'>C</span></div><button _=\\\"on click set result to (<span/> in #box) where it matches .a then put result.length into me\\\">go (parens)</button><button id='b2' _=\\\"on click set result to <span/> in #box where it matches .a then put result.length into me\\\">go</button>"
  :action "find('#b2').click()"
  :check "toHaveText(\"2\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where in init followed by on feature"
  :html "<div id='box'><span class='a'>A</span><span class='b'>B</span></div><button _=\\\"set :items to <span/> in #box where it matches .a on click put :items.length into me\\\">go</button>"
  :action "find('button').click()"
  :check "toHaveText(\"1\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where in component init followed by on feature"
  :html "
			<div id='box'><span class='a'>A</span><span class='b'>B</span></div>
			<template component=\"test-where-comp\"
				_=\"set :items to <span/> in #box where it matches .a
				   on click put :items.length into me\">
				<slot/>
			</template>
			<test-where-comp>go</test-where-comp>
		"
  :action "find('test-where-comp').click()"
  :check "toHaveText(\"1\")"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where with is not me in component template"
  :html "
			<div id='box'><input type=\"checkbox\" class=\"cb\"><input type=\"checkbox\" class=\"cb\"></div>
			<template component=\"test-where-me\">
				<input type=\"checkbox\" _=\"set :checkboxes to <input[type=checkbox]/> in #box where it is not me on change set checked of the :checkboxes to my checked\">
			</template>
			<test-where-me></test-where-me>
		"
  :action "find('test-where-me input').click()"
  :check ""
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "where with is not me followed by on feature"
  :html "
			<table>
			<tr><td><input type=\"checkbox\" class=\"cb\" checked></td></tr>
			<tr><td><input type=\"checkbox\" class=\"cb\"></td></tr>
			<tr><td><input type=\"checkbox\" class=\"cb\" checked></td></tr>
			<tr><td><input id=\"master\" type=\"checkbox\"
				_=\"set :checkboxes to <input[type=checkbox]/> in the closest <table/> where it is not me
				   on change set checked of the :checkboxes to my checked\"></td></tr>
			</table>
		"
  :action "find('#master').click()"
  :check ""
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))")
(~hyperscript/hs-test-card
  :name "full select-all pattern with multiple on features"
  :html "
			<table>
			<tr><td><input type=\"checkbox\" class=\"cb\" checked></td></tr>
			<tr><td><input type=\"checkbox\" class=\"cb\"></td></tr>
			<tr><td><input type=\"checkbox\" class=\"cb\" checked></td></tr>
			<tr><td><input id=\"master\" type=\"checkbox\"
				_=\"set :checkboxes to <input[type=checkbox]/> in the closest <table/> where it is not me
				   on change
				     set checked of the :checkboxes to my checked
				   on change from the closest <table/>
				     if no :checkboxes where it is checked
				       set my indeterminate to false
				       set my checked to false
				     else if no :checkboxes where it is not checked
				       set my indeterminate to false
				       set my checked to true
				     else
				       set my indeterminate to true
				     end\"></td></tr>
			</table>
		"
  :action "find('#master').click()"
  :check "toBe(true)"
  :run-src "(fn (sandbox) (error \"not yet runnable in gallery — see test suite\"))"))))
