",
"action": "div.click(); div.click(); div.click()",
"check": "div.innerHTML.should.equal(\"0\")",
"async": false,
"complexity": "simple"
},
{
"category": "increment",
"name": "can decrement a value multiple times",
"html": "",
"action": "div.click(); div.click(); div.click(); div.click(); div.click()",
"check": "div.innerHTML.should.equal(\"-5\")",
"async": false,
"complexity": "simple"
},
{
"category": "increment",
"name": "can decrement by zero",
"html": "",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"20\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "can append a string to another string",
"html": "",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"Hello there. General Kenobi.\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "can append a value into an array",
"html": "",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"1,2,3,4\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "can append a value to 'it'",
"html": "",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"1,2,3,4\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "can append a value to a DOM node",
"html": "
This is my inner HTML' to me\n append 'With Tags' to me\">
",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"This is my inner HTMLWith Tags\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "can append a value to a DOM element",
"html": "",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"Content\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "can append a value to I",
"html": "",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"Content\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "can append a value to an object property",
"html": "",
"action": "div.click()",
"check": "div.id.should.equal(\"id_new\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "multiple appends work",
"html": "",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"foobardoh\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "append to undefined ignores the undefined",
"html": "",
"action": "div.click()",
"check": "div.innerHTML.should.equal(\"bar\")",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "append preserves existing content rather than overwriting it",
"html": "
New Content' to me\">
",
"action": "btn.click(); div.click(); btn.click()",
"check": "clicks.should.equal(1) && div.innerHTML.should.contain(\"New Content\") && btn.parentNode.should.equal(div)",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "new content added by append will be live",
"html": "
Test\\` to me\">
",
"action": "div.click(); btn.click()",
"check": "window.temp.should.equal(1)",
"async": false,
"complexity": "simple"
},
{
"category": "append",
"name": "new DOM content added by append will be live",
"html": " then append it to me\">
",
"action": "(see body)",
"check": "byId(\"d3\").innerText.should.equal(\"42\")",
"async": false,
"complexity": "simple"
},
{
"category": "def",
"name": "can install a function on an element and use in children w/ return value",
"html": "
",
"action": "(see body)",
"check": "byId(\"d1\").innerText.should.equal(\"42\")",
"async": false,
"complexity": "simple"
},
{
"category": "def",
"name": "can install a function on an element and use me symbol correctly",
"html": "
\"\n\t\t);\n\t\tawait find('#inner').dispatchEvent('click');\n\t\t// halt stops propagation \u2014 outer should NOT get the click\n\t\tawait expect(find('#outer')).not.toHaveClass(/outer-clicked/);"
},
{
"category": "halt",
"name": "halt stops execution after the halt",
"html": "
\"\n\t\t);\n\t\tawait find('#inner').dispatchEvent('click');\n\t\t// bubbling stopped \u2014 outer should NOT get click\n\t\tawait expect(find('#outer')).not.toHaveClass(/outer-clicked/);\n\t\t// but execution halts (no keepExecuting)\n\t\tawait expect(find('#inner')).not.toHaveClass(/continued/);"
},
{
"category": "halt",
"name": "halt works outside of event context",
"html": "",
"action": "",
"check": "",
"async": true,
"complexity": "promise",
"source": "new_file",
"file": "test/commands/halt.js",
"body": "// halt in init (no event) should not throw \"did not return a next element\"\n\t\tvar error = await evaluate(() => {\n\t\t\treturn new Promise(resolve => {\n\t\t\t\twindow.addEventListener('error', function handler(e) {\n\t\t\t\t\twindow.removeEventListener('error', handler);\n\t\t\t\t\tresolve(e.message);\n\t\t\t\t});\n\t\t\t\tvar wa = document.getElementById('work-area');\n\t\t\t\twa.innerHTML = \"\";\n\t\t\t\t_hyperscript.processNode(wa);\n\t\t\t\tsetTimeout(() => resolve(null), 200);\n\t\t\t});\n\t\t});\n\t\texpect(error).toBeNull();"
},
{
"category": "halt",
"name": "halt default only prevents default, not propagation",
"html": "
\n\t\t`)\n\t\tawait expect.poll(() => find('span').textContent()).toBe('blocked')"
},
{
"category": "dom-scope",
"name": "parent of jumps past matching ancestor to its parent",
"html": "\n\t\t\t
\" +\n\t\t\t\"\"\n\t\t);\n\t\tawait find('button').dispatchEvent('click');\n\t\tvar order = await evaluate(() =>\n\t\t\tArray.from(document.querySelector('#container').children).map(e => e.textContent.trim())\n\t\t);\n\t\texpect(order).toEqual([\"B\", \"A\"]);"
},
{
"category": "assignableElements",
"name": "put into still works as innerHTML",
"html": "
\" +\n\t\t\t\"\" +\n\t\t\t\"\"\n\t\t);\n\t\tawait find('button').click();\n\t\tawait expect(find('#out')).toHaveText(\"AC\");"
},
{
"category": "collectionExpressions",
"name": "sorts by a property",
"html": "",
"action": "",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`set arr to [{name: \"Charlie\"}, {name: \"Alice\"}, {name: \"Bob\"}]\n\t\t\tthen return arr sorted by its name`);\n\t\texpect(result.map(x => x.name)).toEqual([\"Alice\", \"Bob\", \"Charlie\"]);"
},
{
"category": "collectionExpressions",
"name": "sorts descending",
"html": "",
"action": "",
"check": "toEqual([3, 2, 1])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`set arr to [3, 1, 2]\n\t\t\tthen return arr sorted by it descending`);\n\t\texpect(result).toEqual([3, 2, 1]);"
},
{
"category": "collectionExpressions",
"name": "sorts numbers by a computed key",
"html": "",
"action": "",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`set arr to [{name: \"b\", age: 30}, {name: \"a\", age: 20}, {name: \"c\", age: 25}]\n\t\t\tthen return arr sorted by its age`);\n\t\texpect(result.map(x => x.name)).toEqual([\"a\", \"c\", \"b\"]);"
},
{
"category": "collectionExpressions",
"name": "maps to a property",
"html": "",
"action": "",
"check": "toEqual([\"Alice\", \"Bob\"])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`set arr to [{name: \"Alice\"}, {name: \"Bob\"}]\n\t\t\tthen return arr mapped to its name`);\n\t\texpect(result).toEqual([\"Alice\", \"Bob\"]);"
},
{
"category": "collectionExpressions",
"name": "maps with an expression",
"html": "",
"action": "",
"check": "toEqual([2, 4, 6])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`set arr to [1, 2, 3]\n\t\t\tthen return arr mapped to (it * 2)`);\n\t\texpect(result).toEqual([2, 4, 6]);"
},
{
"category": "collectionExpressions",
"name": "where then mapped to",
"html": "",
"action": "",
"check": "toEqual([\"Alice\", \"Charlie\"])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`set arr to [{name: \"Alice\", active: true}, {name: \"Bob\", active: false}, {name: \"Charlie\", active: true}]\n\t\t\tthen return arr where its active mapped to its name`);\n\t\texpect(result).toEqual([\"Alice\", \"Charlie\"]);"
},
{
"category": "collectionExpressions",
"name": "sorted by then mapped to",
"html": "",
"action": "",
"check": "toEqual([\"Alice\", \"Charlie\"])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`set arr to [{name: \"Charlie\", age: 30}, {name: \"Alice\", age: 20}]\n\t\t\tthen return arr sorted by its age mapped to its name`);\n\t\texpect(result).toEqual([\"Alice\", \"Charlie\"]);"
},
{
"category": "collectionExpressions",
"name": "where then sorted by then mapped to",
"html": "",
"action": "",
"check": "toEqual([\"Bob\", \"Charlie\"])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`set arr to [{name: \"Charlie\", active: true, age: 30}, {name: \"Alice\", active: false, age: 20}, {name: \"Bob\", active: true, age: 25}]\n\t\t\tthen return arr where its active sorted by its age mapped to its name`);\n\t\texpect(result).toEqual([\"Bob\", \"Charlie\"]);"
},
{
"category": "collectionExpressions",
"name": "the result inside where refers to previous command result, not current element",
"html": "",
"action": "",
"check": "toEqual([4, 5])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(`get 3\n\t\t\tthen set arr to [1, 2, 3, 4, 5]\n\t\t\tthen return arr where it > the result`);\n\t\texpect(result).toEqual([4, 5]);"
},
{
"category": "collectionExpressions",
"name": "where binds after in without parens",
"html": "
ABC
",
"action": "await run(\" in #container where it matches .a\"",
"check": "toBe(2)",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "await html(\n\t\t\t\"
\" +\n\t\t\t\"ABC\" +\n\t\t\t\"
\"\n\t\t);\n\t\tvar result = await run(\" in #container where it matches .a\");\n\t\texpect(result.length).toBe(2);"
},
{
"category": "collectionExpressions",
"name": "sorted by binds after in without parens",
"html": "
C
A
B
",
"action": "await run(\" in #list where its textContent is not '",
"check": "toBe(2)",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "await html(\n\t\t\t\"
C
A
B
\"\n\t\t);\n\t\tvar result = await run(\" in #list where its textContent is not 'A'\");\n\t\texpect(result.length).toBe(2);"
},
{
"category": "collectionExpressions",
"name": "where binds after property access",
"html": "",
"action": "await run(\"obj.items where it > 2\"",
"check": "toEqual([3, 4])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "var result = await run(\"obj.items where it > 2\", {\n\t\t\tlocals: { obj: { items: [1, 2, 3, 4] } }\n\t\t});\n\t\texpect(result).toEqual([3, 4]);"
},
{
"category": "collectionExpressions",
"name": "where after in with mapped to",
"html": "
A
B
C
",
"action": "await run(\n\t\t\t\" in #items where it matches .yes mapped to its textContent\"",
"check": "toEqual([\"A\", \"C\"])",
"async": true,
"complexity": "run-eval",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "await html(\n\t\t\t\"
A
B
C
\"\n\t\t);\n\t\tvar result = await run(\n\t\t\t\" in #items where it matches .yes mapped to its textContent\"\n\t\t);\n\t\texpect(result).toEqual([\"A\", \"C\"]);"
},
{
"category": "collectionExpressions",
"name": "where binds after in on closest",
"html": "
ABC
in #box) where it matches .a then put result.length into me\\\">go (parens) in #box where it matches .a then put result.length into me\\\">go",
"action": "find('#b2').click()",
"check": "toHaveText(\"2\")",
"async": true,
"complexity": "simple",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "await html(\n\t\t\t\"
ABC
\" +\n\t\t\t\" in #box) where it matches .a then put result.length into me\\\">go (parens)\" +\n\t\t\t\" in #box where it matches .a then put result.length into me\\\">go\"\n\t\t);\n\t\tawait find('button').first().click();\n\t\tawait expect(find('button').first()).toHaveText(\"2\");\n\t\tawait find('#b2').click();\n\t\tawait expect(find('#b2')).toHaveText(\"2\");"
},
{
"category": "collectionExpressions",
"name": "where in init followed by on feature",
"html": "
AB
in #box where it matches .a on click put :items.length into me\\\">go",
"action": "find('button').click()",
"check": "toHaveText(\"1\")",
"async": true,
"complexity": "simple",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "await html(\n\t\t\t\"
AB
\" +\n\t\t\t\" in #box where it matches .a \" +\n\t\t\t\"on click put :items.length into me\\\">go\"\n\t\t);\n\t\tawait find('button').click();\n\t\tawait expect(find('button')).toHaveText(\"1\");"
},
{
"category": "collectionExpressions",
"name": "where in component init followed by on feature",
"html": "\n\t\t\t
AB
\n\t\t\t in #box where it matches .a\n\t\t\t\t on click put :items.length into me\">\n\t\t\t\t\n\t\t\t\n\t\t\tgo\n\t\t",
"action": "find('test-where-comp').click()",
"check": "toHaveText(\"1\")",
"async": true,
"complexity": "simple",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "await html(`\n\t\t\t
AB
\n\t\t\t in #box where it matches .a\n\t\t\t\t on click put :items.length into me\">\n\t\t\t\t\n\t\t\t\n\t\t\tgo\n\t\t`);\n\t\tawait find('test-where-comp').click();\n\t\tawait expect(find('test-where-comp')).toHaveText(\"1\");"
},
{
"category": "collectionExpressions",
"name": "where with is not me in component template",
"html": "\n\t\t\t\n\t\t\t\n\t\t\t\t in #box where it is not me on change set checked of the :checkboxes to my checked\">\n\t\t\t\n\t\t\t\n\t\t",
"action": "find('test-where-me input').click()",
"check": "",
"async": true,
"complexity": "evaluate",
"source": "new_file",
"file": "test/expressions/collectionExpressions.js",
"body": "await html(`\n\t\t\t\n\t\t\t\n\t\t\t\t in #box where it is not me on change set checked of the :checkboxes to my checked\">\n\t\t\t\n\t\t\t\n\t\t`);\n\t\tvar attr = await evaluate(() => document.querySelector('test-where-me input')?.getAttribute('_'));\n\t\tconsole.log(\"ATTR:\", attr);\n\t\tawait find('test-where-me input').click();\n\t\tawait expect.poll(() => find('.cb').first().isChecked()).toBe(true);"
},
{
"category": "collectionExpressions",
"name": "where with is not me followed by on feature",
"html": "\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
in the closest
where it is not me\n\t\t\t\t on change set checked of the :checkboxes to my checked\">
where it is not me\n\t\t\t\t on change set checked of the :checkboxes to my checked\">
\n\t\t\t
\n\t\t`);\n\t\tawait find('#master').click();\n\t\tawait expect.poll(() => find('.cb').first().isChecked()).toBe(true);"
},
{
"category": "collectionExpressions",
"name": "full select-all pattern with multiple on features",
"html": "\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t
in the closest
where it is not me\n\t\t\t\t on change\n\t\t\t\t set checked of the :checkboxes to my checked\n\t\t\t\t on change from the closest
\n\t\t\t\t if no :checkboxes where it is checked\n\t\t\t\t set my indeterminate to false\n\t\t\t\t set my checked to false\n\t\t\t\t else if no :checkboxes where it is not checked\n\t\t\t\t set my indeterminate to false\n\t\t\t\t set my checked to true\n\t\t\t\t else\n\t\t\t\t set my indeterminate to true\n\t\t\t\t end\">
where it is not me\n\t\t\t\t on change\n\t\t\t\t set checked of the :checkboxes to my checked\n\t\t\t\t on change from the closest
\n\t\t\t\t if no :checkboxes where it is checked\n\t\t\t\t set my indeterminate to false\n\t\t\t\t set my checked to false\n\t\t\t\t else if no :checkboxes where it is not checked\n\t\t\t\t set my indeterminate to false\n\t\t\t\t set my checked to true\n\t\t\t\t else\n\t\t\t\t set my indeterminate to true\n\t\t\t\t end\">
\n\t\t\t
\n\t\t`);\n\t\t// master check should check all\n\t\tawait find('#master').click();\n\t\tawait expect.poll(() => find('.cb').first().isChecked()).toBe(true);\n\t\t// uncheck one child - master should become indeterminate\n\t\tawait find('.cb').first().click();\n\t\tvar indet = await evaluate(() => document.querySelector('#master').indeterminate);\n\t\texpect(indet).toBe(true);"
},
{
"category": "dom-scope",
"name": "child reads ^var set by parent",
"html": "
`\n\t\t)\n\t\tawait find('button').click()\n\t\tawait expect(find('span')).toHaveText('created')"
},
{
"category": "dom-scope",
"name": "child write updates the ancestor, not a local copy",
"html": "
`\n\t\t)\n\t\tawait find('button').click()\n\t\t// read from a sibling \u2014 should see the ancestor's updated value\n\t\tawait find('span').click()\n\t\tawait expect(find('span')).toHaveText('10')"
},
{
"category": "dom-scope",
"name": "increment works on inherited var",
"html": "
",
"action": "find('div').dispatchEvent('click')",
"check": "toBeVisible(); toBeVisible()",
"async": true,
"complexity": "simple",
"source": "new_in_common",
"file": "test/commands/show.js",
"body": "await html(\n\t\t\t\" in me when the result is 'found'\\\">\" +\n\t\t\t\"A\" +\n\t\t\t\"B\" +\n\t\t\t\"\"\n\t\t);\n\t\tawait find('div').dispatchEvent('click');\n\t\tawait expect(find('#s1')).toBeVisible();\n\t\tawait expect(find('#s2')).toBeVisible();"
},
{
"category": "show",
"name": "the result after show...when is the matched elements",
"html": " in me when its textContent is 'yes' if the result is empty put 'none' into #out else put 'some' into #out\\\">
yes
no
--",
"action": "find('div').dispatchEvent('click')",
"check": "toHaveText(\"some\")",
"async": true,
"complexity": "simple",
"source": "new_in_common",
"file": "test/commands/show.js",
"body": "await html(\n\t\t\t\" in me when its textContent is 'yes' \" +\n\t\t\t\" if the result is empty put 'none' into #out \" +\n\t\t\t\" else put 'some' into #out\\\">\" +\n\t\t\t\"
\")\n\t\tlet value = await evaluate(() => document.getElementById('outerDiv2').getAttribute(\"foo\"))\n\t\texpect(value).toBe(\"bar\")\n\t\tawait find('#d1b').dispatchEvent('click')\n\t\tawait expect.poll(() => evaluate(() => document.getElementById('outerDiv2').getAttribute(\"foo\"))).toBe(\"doh\")"
},
{
"category": "closest",
"name": "closest does not consume a following where clause",
"html": "
in the closest
where it is not me on click put :others.length into #out\\\">
\" +\n\t\t\t\"\" +\n\t\t\t\"\" +\n\t\t\t\" in the closest
where it is not me \" +\n\t\t\t\"on click put :others.length into #out\\\">\" +\n\t\t\t\"
\" +\n\t\t\t\"\"\n\t\t);\n\t\tawait find('#master').click();\n\t\tawait expect(find('#out')).toHaveText(\"2\");"
},
{
"category": "closest",
"name": "closest with to modifier still works after parse change",
"html": "
\")\n\t\tlet result = await evaluate(() => {\n\t\t\tconst inner = document.getElementById('inner')\n\t\t\tconst outer = document.getElementById('outer')\n\t\t\treturn _hyperscript(\"closest to my.parentElement\", { me: inner }) === outer\n\t\t})\n\t\texpect(result).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "is a works with instanceof fallback",
"html": "",
"action": "find('#d1').dispatchEvent('click')",
"check": "toHaveText(\"yes\")",
"async": true,
"complexity": "simple",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\");\n\t\tawait find('#d1').dispatchEvent('click');\n\t\tawait expect(find('#d1')).toHaveText(\"yes\");"
},
{
"category": "comparisonOperator",
"name": "is a Node works via instanceof",
"html": "",
"action": "find('#d1').dispatchEvent('click')",
"check": "toHaveText(\"yes\")",
"async": true,
"complexity": "simple",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\");\n\t\tawait find('#d1').dispatchEvent('click');\n\t\tawait expect(find('#d1')).toHaveText(\"yes\");"
},
{
"category": "comparisonOperator",
"name": "is not a works with instanceof fallback",
"html": "",
"action": "find('#d1').dispatchEvent('click')",
"check": "toHaveText(\"yes\")",
"async": true,
"complexity": "simple",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\");\n\t\tawait find('#d1').dispatchEvent('click');\n\t\tawait expect(find('#d1')).toHaveText(\"yes\");"
},
{
"category": "comparisonOperator",
"name": "is ignoring case works",
"html": "",
"action": "await run(\"'; await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'Hello' is 'hello' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello' is 'HELLO' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello' is 'world' ignoring case\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is not ignoring case works",
"html": "",
"action": "await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'Hello' is not 'world' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello' is not 'hello' ignoring case\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "contains ignoring case works",
"html": "",
"action": "await run(\"'; await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'Hello World' contains 'hello' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello World' contains 'WORLD' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello World' contains 'missing' ignoring case\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "matches ignoring case works",
"html": "",
"action": "await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'Hello' matches 'hello' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello' matches 'HELLO' ignoring case\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "starts with works",
"html": "",
"action": "await run(\"'; await run(\"'; await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'hello world' starts with 'hello'\")).toBe(true)\n\t\texpect(await run(\"'hello world' starts with 'world'\")).toBe(false)\n\t\texpect(await run(\"'hello' starts with 'hello'\")).toBe(true)\n\t\texpect(await run(\"'' starts with 'x'\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "ends with works",
"html": "",
"action": "await run(\"'; await run(\"'; await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'hello world' ends with 'world'\")).toBe(true)\n\t\texpect(await run(\"'hello world' ends with 'hello'\")).toBe(false)\n\t\texpect(await run(\"'hello' ends with 'hello'\")).toBe(true)\n\t\texpect(await run(\"'' ends with 'x'\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "does not start with works",
"html": "",
"action": "await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'hello world' does not start with 'hello'\")).toBe(false)\n\t\texpect(await run(\"'hello world' does not start with 'world'\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "does not end with works",
"html": "",
"action": "await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'hello world' does not end with 'world'\")).toBe(false)\n\t\texpect(await run(\"'hello world' does not end with 'hello'\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "starts with null is false",
"html": "",
"action": "await run(\"null starts with '; await run(\"null does not start with '",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"null starts with 'x'\")).toBe(false)\n\t\texpect(await run(\"null does not start with 'x'\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "ends with null is false",
"html": "",
"action": "await run(\"null ends with '; await run(\"null does not end with '",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"null ends with 'x'\")).toBe(false)\n\t\texpect(await run(\"null does not end with 'x'\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "starts with ignoring case works",
"html": "",
"action": "await run(\"'; await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'Hello World' starts with 'hello' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello World' starts with 'HELLO' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello World' starts with 'world' ignoring case\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "ends with ignoring case works",
"html": "",
"action": "await run(\"'; await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'Hello World' ends with 'world' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello World' ends with 'WORLD' ignoring case\")).toBe(true)\n\t\texpect(await run(\"'Hello World' ends with 'hello' ignoring case\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "starts with coerces to string",
"html": "",
"action": "await run(\"123 starts with '; await run(\"123 starts with '",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"123 starts with '12'\")).toBe(true)\n\t\texpect(await run(\"123 starts with '23'\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "ends with coerces to string",
"html": "",
"action": "await run(\"123 ends with '; await run(\"123 ends with '",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"123 ends with '23'\")).toBe(true)\n\t\texpect(await run(\"123 ends with '12'\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is between works",
"html": "",
"action": "await run(\"5 is between 1 and 10\"; await run(\"1 is between 1 and 10\"; await run(\"10 is between 1 and 10\"; await run(\"0 is between 1 and 10\"; await run(\"11 is between 1 and 10\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"5 is between 1 and 10\")).toBe(true)\n\t\texpect(await run(\"1 is between 1 and 10\")).toBe(true)\n\t\texpect(await run(\"10 is between 1 and 10\")).toBe(true)\n\t\texpect(await run(\"0 is between 1 and 10\")).toBe(false)\n\t\texpect(await run(\"11 is between 1 and 10\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is not between works",
"html": "",
"action": "await run(\"5 is not between 1 and 10\"; await run(\"0 is not between 1 and 10\"; await run(\"11 is not between 1 and 10\"; await run(\"1 is not between 1 and 10\"; await run(\"10 is not between 1 and 10\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"5 is not between 1 and 10\")).toBe(false)\n\t\texpect(await run(\"0 is not between 1 and 10\")).toBe(true)\n\t\texpect(await run(\"11 is not between 1 and 10\")).toBe(true)\n\t\texpect(await run(\"1 is not between 1 and 10\")).toBe(false)\n\t\texpect(await run(\"10 is not between 1 and 10\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "between works with strings",
"html": "",
"action": "await run(\"'; await run(\"'",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"'b' is between 'a' and 'c'\")).toBe(true)\n\t\texpect(await run(\"'d' is between 'a' and 'c'\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "I am between works",
"html": "",
"action": "await run(\"I am between 1 and 10\"; await run(\"I am between 1 and 10\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"I am between 1 and 10\", { me: 5 })).toBe(true)\n\t\texpect(await run(\"I am between 1 and 10\", { me: 0 })).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "I am not between works",
"html": "",
"action": "await run(\"I am not between 1 and 10\"; await run(\"I am not between 1 and 10\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"I am not between 1 and 10\", { me: 5 })).toBe(false)\n\t\texpect(await run(\"I am not between 1 and 10\", { me: 0 })).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "precedes works",
"html": "",
"action": "",
"check": "",
"async": true,
"complexity": "evaluate",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\")\n\t\texpect(await evaluate(() => _hyperscript(\"x precedes y\", {\n\t\t\tlocals: { x: document.getElementById('a'), y: document.getElementById('b') }\n\t\t}))).toBe(true)\n\t\texpect(await evaluate(() => _hyperscript(\"x precedes y\", {\n\t\t\tlocals: { x: document.getElementById('b'), y: document.getElementById('a') }\n\t\t}))).toBe(false)\n\t\texpect(await evaluate(() => _hyperscript(\"x precedes y\", {\n\t\t\tlocals: { x: document.getElementById('a'), y: document.getElementById('c') }\n\t\t}))).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "follows works",
"html": "",
"action": "",
"check": "",
"async": true,
"complexity": "evaluate",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\")\n\t\texpect(await evaluate(() => _hyperscript(\"x follows y\", {\n\t\t\tlocals: { x: document.getElementById('b'), y: document.getElementById('a') }\n\t\t}))).toBe(true)\n\t\texpect(await evaluate(() => _hyperscript(\"x follows y\", {\n\t\t\tlocals: { x: document.getElementById('a'), y: document.getElementById('b') }\n\t\t}))).toBe(false)\n\t\texpect(await evaluate(() => _hyperscript(\"x follows y\", {\n\t\t\tlocals: { x: document.getElementById('c'), y: document.getElementById('a') }\n\t\t}))).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "does not precede works",
"html": "",
"action": "",
"check": "",
"async": true,
"complexity": "evaluate",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\")\n\t\texpect(await evaluate(() => _hyperscript(\"x does not precede y\", {\n\t\t\tlocals: { x: document.getElementById('b'), y: document.getElementById('a') }\n\t\t}))).toBe(true)\n\t\texpect(await evaluate(() => _hyperscript(\"x does not precede y\", {\n\t\t\tlocals: { x: document.getElementById('a'), y: document.getElementById('b') }\n\t\t}))).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "does not follow works",
"html": "",
"action": "",
"check": "",
"async": true,
"complexity": "evaluate",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\")\n\t\texpect(await evaluate(() => _hyperscript(\"x does not follow y\", {\n\t\t\tlocals: { x: document.getElementById('a'), y: document.getElementById('b') }\n\t\t}))).toBe(true)\n\t\texpect(await evaluate(() => _hyperscript(\"x does not follow y\", {\n\t\t\tlocals: { x: document.getElementById('b'), y: document.getElementById('a') }\n\t\t}))).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "precedes with null is false",
"html": "",
"action": "await run(\"null precedes null\"; await run(\"null does not precede null\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"null precedes null\")).toBe(false)\n\t\texpect(await run(\"null does not precede null\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "I precede works",
"html": "",
"action": "find('#a').dispatchEvent('click')",
"check": "toHaveText(\"yes\")",
"async": true,
"complexity": "simple",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\")\n\t\tawait find('#a').dispatchEvent('click')\n\t\tawait expect(find('#a')).toHaveText(\"yes\")"
},
{
"category": "comparisonOperator",
"name": "is really works without equal to",
"html": "",
"action": "await run(\"2 is really 2\"; await run(\"2 is really '",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"2 is really 2\")).toBe(true)\n\t\texpect(await run(\"2 is really '2'\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is not really works without equal to",
"html": "",
"action": "await run(\"2 is not really '; await run(\"2 is not really 2\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"2 is not really '2'\")).toBe(true)\n\t\texpect(await run(\"2 is not really 2\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is equal works without to",
"html": "",
"action": "await run(\"2 is equal 2\"; await run(\"2 is equal 1\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"2 is equal 2\")).toBe(true)\n\t\texpect(await run(\"2 is equal 1\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is not equal works without to",
"html": "",
"action": "await run(\"2 is not equal 2\"; await run(\"2 is not equal 1\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"2 is not equal 2\")).toBe(false)\n\t\texpect(await run(\"2 is not equal 1\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "am works as alias for is",
"html": "",
"action": "await run(\"2 am 2\"; await run(\"2 am 1\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"2 am 2\")).toBe(true)\n\t\texpect(await run(\"2 am 1\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is not undefined still works as equality",
"html": "",
"action": "await run(\"5 is not undefined\"; await run(\"null is not undefined\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"5 is not undefined\")).toBe(true)\n\t\texpect(await run(\"null is not undefined\")).toBe(false) // null == undefined in JS"
},
{
"category": "comparisonOperator",
"name": "is not null still works as equality",
"html": "",
"action": "await run(\"5 is not null\"; await run(\"null is not null\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"5 is not null\")).toBe(true)\n\t\texpect(await run(\"null is not null\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is falls back to boolean property when rhs is undefined",
"html": "",
"action": "await run(\"#c1 is checked\"; await run(\"#c2 is checked\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\")\n\t\texpect(await run(\"#c1 is checked\")).toBe(true)\n\t\texpect(await run(\"#c2 is checked\")).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is not falls back to boolean property when rhs is undefined",
"html": "",
"action": "await run(\"#c1 is not checked\"; await run(\"#c2 is not checked\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\")\n\t\texpect(await run(\"#c1 is not checked\")).toBe(false)\n\t\texpect(await run(\"#c2 is not checked\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "is boolean property works with disabled",
"html": "",
"action": "await run(\"#b1 is disabled\"; await run(\"#b2 is disabled\"; await run(\"#b2 is not disabled\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\")\n\t\texpect(await run(\"#b1 is disabled\")).toBe(true)\n\t\texpect(await run(\"#b2 is disabled\")).toBe(false)\n\t\texpect(await run(\"#b2 is not disabled\")).toBe(true)"
},
{
"category": "comparisonOperator",
"name": "is still does equality when rhs variable exists",
"html": "",
"action": "await run(\"x is y\"; await run(\"x is y\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "expect(await run(\"x is y\", { locals: { x: 5, y: 5 } })).toBe(true)\n\t\texpect(await run(\"x is y\", { locals: { x: 5, y: 6 } })).toBe(false)"
},
{
"category": "comparisonOperator",
"name": "is boolean property works in where clause",
"html": "",
"action": "await run(\".cb where it is checked\"",
"check": "toBe(2)",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/comparisonOperator.js",
"body": "await html(\"\" +\n\t\t\t\"\" +\n\t\t\t\"\")\n\t\tvar result = await run(\".cb where it is checked\")\n\t\texpect(result.length).toBe(2)"
},
{
"category": "cookies",
"name": "length is 0 when no cookies are set",
"html": "",
"action": "",
"check": "toBe(0)",
"async": true,
"complexity": "eval-only",
"source": "new_in_common",
"file": "test/expressions/cookies.js",
"body": "const result = await page.evaluate(() => {\n\t\t\t// Clear all cookies first\n\t\t\tfor (var c of document.cookie.split(\"; \")) {\n\t\t\t\tvar name = c.split(\"=\")[0]\n\t\t\t\tif (name) document.cookie = name + \"=;expires=Thu, 01 Jan 1970 00:00:00 GMT\"\n\t\t\t}\n\t\t\treturn _hyperscript(\"cookies.length\")\n\t\t})\n\t\texpect(result).toBe(0)"
},
{
"category": "in",
"name": "null value in array returns empty",
"html": "",
"action": "await run(\"null in [1, 2, 3]\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/in.js",
"body": "expect(await run(\"null in [1, 2, 3]\")).toEqual([])"
},
{
"category": "logicalOperator",
"name": "and short-circuits when lhs promise resolves to false",
"html": "",
"action": "",
"check": "toBe(false); toBe(false)",
"async": true,
"complexity": "eval-only",
"source": "new_in_common",
"file": "test/expressions/logicalOperator.js",
"body": "const result = await evaluate(async () => {\n\t\t\tlet rhsCalled = false\n\t\t\tconst returnsFalse = () => Promise.resolve(false)\n\t\t\tconst rhs = () => { rhsCalled = true; return true }\n\t\t\tconst r = await _hyperscript(\"returnsFalse() and rhs()\", {locals: {returnsFalse, rhs}})\n\t\t\treturn { result: r, rhsCalled }\n\t\t})\n\t\texpect(result.result).toBe(false)\n\t\texpect(result.rhsCalled).toBe(false)"
},
{
"category": "logicalOperator",
"name": "or short-circuits when lhs promise resolves to true",
"html": "",
"action": "",
"check": "toBe(true); toBe(false)",
"async": true,
"complexity": "eval-only",
"source": "new_in_common",
"file": "test/expressions/logicalOperator.js",
"body": "const result = await evaluate(async () => {\n\t\t\tlet rhsCalled = false\n\t\t\tconst returnsTrue = () => Promise.resolve(true)\n\t\t\tconst rhs = () => { rhsCalled = true; return false }\n\t\t\tconst r = await _hyperscript(\"returnsTrue() or rhs()\", {locals: {returnsTrue, rhs}})\n\t\t\treturn { result: r, rhsCalled }\n\t\t})\n\t\texpect(result.result).toBe(true)\n\t\texpect(result.rhsCalled).toBe(false)"
},
{
"category": "logicalOperator",
"name": "or evaluates rhs when lhs promise resolves to false",
"html": "",
"action": "",
"check": "toBe(\"fallback\"); toBe(true)",
"async": true,
"complexity": "eval-only",
"source": "new_in_common",
"file": "test/expressions/logicalOperator.js",
"body": "const result = await evaluate(async () => {\n\t\t\tlet rhsCalled = false\n\t\t\tconst returnsFalse = () => Promise.resolve(false)\n\t\t\tconst rhs = () => { rhsCalled = true; return \"fallback\" }\n\t\t\tconst r = await _hyperscript(\"returnsFalse() or rhs()\", {locals: {returnsFalse, rhs}})\n\t\t\treturn { result: r, rhsCalled }\n\t\t})\n\t\texpect(result.result).toBe(\"fallback\")\n\t\texpect(result.rhsCalled).toBe(true)"
},
{
"category": "mathOperator",
"name": "array + array concats",
"html": "",
"action": "await run(\"[1, 2] + [3, 4]\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/mathOperator.js",
"body": "expect(await run(\"[1, 2] + [3, 4]\")).toEqual([1, 2, 3, 4])"
},
{
"category": "mathOperator",
"name": "array + single value appends",
"html": "",
"action": "await run(\"[1, 2] + 3\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/mathOperator.js",
"body": "expect(await run(\"[1, 2] + 3\")).toEqual([1, 2, 3])"
},
{
"category": "mathOperator",
"name": "array + array does not mutate original",
"html": "",
"action": "await run(\"set a to [1, 2] then set b to a + [3] then return a\"",
"check": "toEqual([1, 2])",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/mathOperator.js",
"body": "var result = await run(\"set a to [1, 2] then set b to a + [3] then return a\")\n\t\texpect(result).toEqual([1, 2])"
},
{
"category": "mathOperator",
"name": "array concat chains",
"html": "",
"action": "await run(\"[1] + [2] + [3]\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/mathOperator.js",
"body": "expect(await run(\"[1] + [2] + [3]\")).toEqual([1, 2, 3])"
},
{
"category": "mathOperator",
"name": "empty array + array works",
"html": "",
"action": "await run(\"[] + [1, 2]\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/mathOperator.js",
"body": "expect(await run(\"[] + [1, 2]\")).toEqual([1, 2])"
},
{
"category": "no",
"name": "no returns false for non-empty array",
"html": "",
"action": "await run(\"no ['",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/no.js",
"body": "expect(await run(\"no ['thing']\")).toBe(false)"
},
{
"category": "no",
"name": "no with where filters then checks emptiness",
"html": "",
"action": "await run(\"no [1, 2, 3] where it > 5\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/no.js",
"body": "expect(await run(\"no [1, 2, 3] where it > 5\")).toBe(true)"
},
{
"category": "no",
"name": "no with where returns false when matches exist",
"html": "",
"action": "await run(\"no [1, 2, 3] where it > 1\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/no.js",
"body": "expect(await run(\"no [1, 2, 3] where it > 1\")).toBe(false)"
},
{
"category": "no",
"name": "no with where and is not",
"html": "",
"action": "await run(\"no [1, 2, 3] where it is not 2\"",
"check": "toBe(false)",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/no.js",
"body": "var result = await run(\"no [1, 2, 3] where it is not 2\");\n\t\texpect(result).toBe(false)"
},
{
"category": "no",
"name": "no with where on DOM elements",
"html": "
AB
in #box where it matches .c then put 'none' into #out else put 'found' into #out\\\">go",
"action": "find('button').click()",
"check": "toHaveText(\"none\")",
"async": true,
"complexity": "simple",
"source": "new_in_common",
"file": "test/expressions/no.js",
"body": "await html(\n\t\t\t\"
AB
\" +\n\t\t\t\" in #box where it matches .c then put 'none' into #out else put 'found' into #out\\\">go\" +\n\t\t\t\"\"\n\t\t);\n\t\tawait find('button').click();\n\t\tawait expect(find('#out')).toHaveText(\"none\");"
},
{
"category": "objectLiteral",
"name": "allows trailing commas",
"html": "",
"action": "await run(\"{foo:true, bar-baz:false,}\"",
"check": "",
"async": true,
"complexity": "run-eval",
"source": "new_in_common",
"file": "test/expressions/objectLiteral.js",
"body": "expect(await run(\"{foo:true, bar-baz:false,}\")).toEqual({ \"foo\": true, \"bar-baz\": false })"
},
{
"category": "queryRef",
"name": "queryRef w/ $ works",
"html": "",
"action": "",
"check": "toBe(1)",
"async": true,
"complexity": "evaluate",
"source": "new_in_common",
"file": "test/expressions/queryRef.js",
"body": "await html(\"\")\n\t\tconst len = await evaluate(() => {\n\t\t\treturn Array.from(_hyperscript(\"<[foo='${x}']/>\", { locals: { x: \"bar\" } })).length\n\t\t})\n\t\texpect(len).toBe(1)"
},
{
"category": "relativePositionalExpression",
"name": "can access property of next element with possessive",
"html": "
')\n\t\tlet result = await evaluate(() => _hyperscript(\"the previous 's textContent\", {me: document.getElementById('d2')}))\n\t\texpect(result).toBe('world')"
},
{
"category": "relativePositionalExpression",
"name": "can access style of next element with possessive",
"html": "",
"action": "",
"check": "toBe('red')",
"async": true,
"complexity": "evaluate",
"source": "new_in_common",
"file": "test/expressions/relativePositionalExpression.js",
"body": "await html('')\n\t\tlet result = await evaluate(() => _hyperscript(\"the next 's *color\", {me: document.getElementById('d1')}))\n\t\texpect(result).toBe('red')"
},
{
"category": "relativePositionalExpression",
"name": "can write to next element with put command",
"html": "",
"action": "find('#d1').dispatchEvent('click'); evaluate({...})",
"check": "toHaveText('updated')",
"async": true,
"complexity": "eval-only",
"source": "new_in_common",
"file": "test/expressions/relativePositionalExpression.js",
"body": "await evaluate(() => {\n\t\t\tvar wa = document.getElementById('work-area');\n\t\t\twa.innerHTML = '
original
';\n\t\t\twa.querySelector('#d1').setAttribute('_', \"on click put 'updated' into the next 's textContent\");\n\t\t\t_hyperscript.process(wa);\n\t\t});\n\t\tawait find('#d1').dispatchEvent('click');\n\t\tawait expect(find('#d2')).toHaveText('updated');"
}
]