|
|
|
|
@@ -1,6 +1,6 @@
|
|
|
|
|
// Auto-generated from _hyperscript upstream test suite
|
|
|
|
|
// Source: spec/tests/hyperscript-upstream-tests.json
|
|
|
|
|
// 256 tests (90 skipped)
|
|
|
|
|
// 378 tests (453 skipped)
|
|
|
|
|
//
|
|
|
|
|
// DO NOT EDIT — regenerate with: python3 tests/playwright/generate-hs-tests.py
|
|
|
|
|
|
|
|
|
|
@@ -4028,5 +4028,981 @@ module.exports = [
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"async": false
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dialog",
|
|
|
|
|
"name": "show opens a dialog as modal",
|
|
|
|
|
"html": "<dialog id='d'><p>Hello</p></dialog><button _='on click show #d'>Open</button>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dialog",
|
|
|
|
|
"name": "open opens a dialog",
|
|
|
|
|
"html": "<dialog id='d'><p>Hello</p></dialog><button _='on click open #d'>Open</button>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dialog",
|
|
|
|
|
"name": "open opens a details element",
|
|
|
|
|
"html": "<details id='d'><summary>More</summary><p>Content</p></details><button _='on click open #d'>Open</button>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dialog",
|
|
|
|
|
"name": "close closes a details element",
|
|
|
|
|
"html": "<details id='d' open><summary>More</summary><p>Content</p></details><button _='on click close #d'>Close</button>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dialog",
|
|
|
|
|
"name": "open on implicit me",
|
|
|
|
|
"html": "<dialog id='d' _='on myOpen open'></dialog><button _='on click send myOpen to #d'>Open</button>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "can empty an element",
|
|
|
|
|
"html": "<div id='d1'><p>hello</p><p>world</p></div><button _='on click empty #d1'></button>",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "empty with no target empties me",
|
|
|
|
|
"html": "<div id=\"el\" _='on click empty'>content</div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "can empty multiple elements",
|
|
|
|
|
"html": "<div id=\"el\" class='clearme'><p>a</p></div><div class='clearme'><p>b</p></div><button _='on click empty .clearme'></button>",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "can empty an array",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click\n\t\t set :arr to [1,2,3]\n\t\t empty :arr\n\t\t put :arr.length into me\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "can empty a text input",
|
|
|
|
|
"html": "\n\t\t\t<input type=\"text\" id=\"t1\" value=\"hello\" />\n\t\t\t<button _=\"on click empty #t1\">Empty</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "can empty a textarea",
|
|
|
|
|
"html": "\n\t\t\t<textarea id=\"ta1\">some text</textarea>\n\t\t\t<button _=\"on click empty #ta1\">Empty</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "can empty a checkbox",
|
|
|
|
|
"html": "\n\t\t\t<input type=\"checkbox\" id=\"cb1\" checked />\n\t\t\t<button _=\"on click empty #cb1\">Empty</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "can empty a form (clears all inputs)",
|
|
|
|
|
"html": "\n\t\t\t<form id=\"f1\">\n\t\t\t\t<input type=\"text\" id=\"t2\" value=\"val\" />\n\t\t\t\t<textarea id=\"ta2\">text</textarea>\n\t\t\t\t<input type=\"checkbox\" id=\"cb2\" checked />\n\t\t\t</form>\n\t\t\t<button _=\"on click empty #f1\">Empty</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "clear is an alias for empty",
|
|
|
|
|
"html": "\n\t\t\t<input type=\"text\" id=\"t3\" value=\"hello\" />\n\t\t\t<button _=\"on click clear #t3\">Clear</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "empty",
|
|
|
|
|
"name": "clear works on elements",
|
|
|
|
|
"html": "<div id='d2'><p>content</p></div><button _='on click clear #d2'></button>",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "halt",
|
|
|
|
|
"name": "halts event propagation and default",
|
|
|
|
|
"html": "<div id='outer' _='on click add .outer-clicked'> <a id='inner' href='#shouldnot' _='on click halt'>click me</a></div>",
|
|
|
|
|
"action": "find('#inner').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "halt",
|
|
|
|
|
"name": "halt stops execution after the halt",
|
|
|
|
|
"html": "<div id=\"el\" _='on click halt then add .should-not-happen'>test</div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "halt",
|
|
|
|
|
"name": "halt the event stops propagation but continues execution",
|
|
|
|
|
"html": "<div id='outer' _='on click add .outer-clicked'> <div id='inner' _='on click halt the event then add .continued'>click me</div></div>",
|
|
|
|
|
"action": "find('#inner').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "halt",
|
|
|
|
|
"name": "halt the event's stops propagation but continues execution",
|
|
|
|
|
"html": "<div id='outer' _='on click add .outer-clicked'> <div id='inner' _=\\\"on click halt the event's then add .continued\\\">click me</div></div>",
|
|
|
|
|
"action": "find('#inner').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "halt",
|
|
|
|
|
"name": "halt bubbling only stops propagation, not default",
|
|
|
|
|
"html": "<div id='outer' _='on click add .outer-clicked'> <div id='inner' _='on click halt bubbling then add .continued'>click me</div></div>",
|
|
|
|
|
"action": "find('#inner').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "halt",
|
|
|
|
|
"name": "halt default only prevents default, not propagation",
|
|
|
|
|
"html": "<div id='outer' _='on click add .outer-clicked'> <div id='inner' _='on click halt default'>click me</div></div>",
|
|
|
|
|
"action": "find('#inner').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "morph",
|
|
|
|
|
"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')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "morph",
|
|
|
|
|
"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')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "morph",
|
|
|
|
|
"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 _="on click put `clicked` into me">new</p></div>'\\\">go</button>",
|
|
|
|
|
"action": "find('#go').dispatchEvent('click'); find('#inner').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "morph",
|
|
|
|
|
"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')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "reset",
|
|
|
|
|
"name": "can reset a form",
|
|
|
|
|
"html": "\n\t\t\t<form id=\"f1\">\n\t\t\t\t<input type=\"text\" id=\"t1\" value=\"original\" />\n\t\t\t\t<button type=\"button\" _=\"on click set #t1's value to 'changed'\">Change</button>\n\t\t\t\t<button type=\"button\" id=\"rst\" _=\"on click reset #f1\">Reset</button>\n\t\t\t</form>\n\t\t",
|
|
|
|
|
"action": "find('#t1').fill('changed'); find('#rst').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "reset",
|
|
|
|
|
"name": "reset with no target resets me (form)",
|
|
|
|
|
"html": "\n\t\t\t<form _=\"on custom reset\">\n\t\t\t\t<input type=\"text\" id=\"t2\" value=\"default\" />\n\t\t\t</form>\n\t\t",
|
|
|
|
|
"action": "find('#t2').fill('modified'); find('form').dispatchEvent('custom')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "reset",
|
|
|
|
|
"name": "can reset a text input to defaultValue",
|
|
|
|
|
"html": "\n\t\t\t<input type=\"text\" id=\"t3\" value=\"hello\" />\n\t\t\t<button _=\"on click reset #t3\">Reset</button>\n\t\t",
|
|
|
|
|
"action": "find('#t3').fill('goodbye'); find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "reset",
|
|
|
|
|
"name": "can reset a checkbox",
|
|
|
|
|
"html": "\n\t\t\t<input type=\"checkbox\" id=\"cb1\" checked />\n\t\t\t<button _=\"on click reset #cb1\">Reset</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "reset",
|
|
|
|
|
"name": "can reset an unchecked checkbox",
|
|
|
|
|
"html": "\n\t\t\t<input type=\"checkbox\" id=\"cb2\" />\n\t\t\t<button _=\"on click reset #cb2\">Reset</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "reset",
|
|
|
|
|
"name": "can reset a textarea",
|
|
|
|
|
"html": "\n\t\t\t<textarea id=\"ta1\">original text</textarea>\n\t\t\t<button _=\"on click reset #ta1\">Reset</button>\n\t\t",
|
|
|
|
|
"action": "find('#ta1').fill('new text'); find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "reset",
|
|
|
|
|
"name": "can reset a select",
|
|
|
|
|
"html": "\n\t\t\t<select id=\"sel1\">\n\t\t\t\t<option value=\"a\">A</option>\n\t\t\t\t<option value=\"b\" selected>B</option>\n\t\t\t\t<option value=\"c\">C</option>\n\t\t\t</select>\n\t\t\t<button _=\"on click reset #sel1\">Reset</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "reset",
|
|
|
|
|
"name": "can reset multiple inputs",
|
|
|
|
|
"html": "\n\t\t\t<input type=\"text\" class=\"resettable\" value=\"one\" />\n\t\t\t<input type=\"text\" class=\"resettable\" value=\"two\" />\n\t\t\t<button _=\"on click reset .resettable\">Reset</button>\n\t\t",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "swap",
|
|
|
|
|
"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')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "swap",
|
|
|
|
|
"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>\n\t\t\t<span id='a'>x</span><span id='b'>y</span>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "swap",
|
|
|
|
|
"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>\n\t\t\t<span id='target' data-val='x'></span>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "bind",
|
|
|
|
|
"name": "attribute bound to another element input value",
|
|
|
|
|
"html": "<input type=\"text\" id=\"title-input\" value=\"Hello\" /><h1 _=\"bind @data-title and #title-input's value\"></h1>",
|
|
|
|
|
"action": "find('#title-input').fill('World')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "when",
|
|
|
|
|
"name": "detects changes from :element variable",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set :count to 0 end\n\t\t\t when :count changes put it into me end\n\t\t\t on click increment :count\">0</div>",
|
|
|
|
|
"action": "find('div').click(); find('div').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "when",
|
|
|
|
|
"name": "works with on handlers that modify the watched variable",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set :label to 'initial' end\n\t\t\t when :label changes put it into me end\n\t\t\t on click set :label to 'clicked'\">initial</div>",
|
|
|
|
|
"action": "find('div').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "when",
|
|
|
|
|
"name": "isolates element-scoped variables between elements",
|
|
|
|
|
"html": "<div id=\"d1\" _=\"init set :value to 'A' end\n\t\t\t when :value changes put it into me end\n\t\t\t on click set :value to 'A-clicked'\">A</div><div id=\"d2\" _=\"init set :value to 'B' end\n\t\t\t when :value changes put it into me end\n\t\t\t on click set :value to 'B-clicked'\">B</div>",
|
|
|
|
|
"action": "find('#d1').click(); find('#d2').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "when",
|
|
|
|
|
"name": "value of #element is tracked",
|
|
|
|
|
"html": "<input type=\"text\" id=\"of-input\" value=\"init\" /><span _=\"when (value of #of-input) changes put it into me\"></span>",
|
|
|
|
|
"action": "find('#of-input').fill('changed')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "liveTemplate",
|
|
|
|
|
"name": "processes hyperscript on inner elements",
|
|
|
|
|
"html": "\n\t\t\t<template live _=\"init set ^val to 0\">\n\t\t\t\t<button _=\"on click increment ^val then put ^val into the next <output/>\">+</button>\n\t\t\t\t<output>0</output>\n\t\t\t</template>\n\t\t",
|
|
|
|
|
"action": "find('[data-live-template] button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "assignableElements",
|
|
|
|
|
"name": "set closest replaces ancestor",
|
|
|
|
|
"html": "<div id=\"el\" class='wrapper'><button _='on click set (closest <div/>) to \\\"<div class=wrapper>replaced</div>\\\"'>go</button></div>",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "assignableElements",
|
|
|
|
|
"name": "hyperscript in replacement content is initialized",
|
|
|
|
|
"html": "<div id='target'>old</div><button id='go' _=\\\"on click set #target to '<div id=target _="on click put `clicked` into me">new</div>'\\\">go</button>",
|
|
|
|
|
"action": "find('#go').dispatchEvent('click'); find('#target').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "assignableElements",
|
|
|
|
|
"name": "put into still works as innerHTML",
|
|
|
|
|
"html": "<div id='target'>old</div><button _='on click put \\\"new\\\" into #target'>go</button>",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "collectionExpressions",
|
|
|
|
|
"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()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "collectionExpressions",
|
|
|
|
|
"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()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "collectionExpressions",
|
|
|
|
|
"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()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "collectionExpressions",
|
|
|
|
|
"name": "where in component init followed by on feature",
|
|
|
|
|
"html": "\n\t\t\t<div id='box'><span class='a'>A</span><span class='b'>B</span></div>\n\t\t\t<template component=\"test-where-comp\"\n\t\t\t\t_=\"set :items to <span/> in #box where it matches .a\n\t\t\t\t on click put :items.length into me\">\n\t\t\t\t<slot/>\n\t\t\t</template>\n\t\t\t<test-where-comp>go</test-where-comp>\n\t\t",
|
|
|
|
|
"action": "find('test-where-comp').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "collectionExpressions",
|
|
|
|
|
"name": "where with is not me followed by on feature",
|
|
|
|
|
"html": "\n\t\t\t<table>\n\t\t\t<tr><td><input type=\"checkbox\" class=\"cb\" checked></td></tr>\n\t\t\t<tr><td><input type=\"checkbox\" class=\"cb\"></td></tr>\n\t\t\t<tr><td><input type=\"checkbox\" class=\"cb\" checked></td></tr>\n\t\t\t<tr><td><input id=\"master\" type=\"checkbox\"\n\t\t\t\t_=\"set :checkboxes to <input[type=checkbox]/> in the closest <table/> where it is not me\n\t\t\t\t on change set checked of the :checkboxes to my checked\"></td></tr>\n\t\t\t</table>\n\t\t",
|
|
|
|
|
"action": "find('#master').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "child reads ^var set by parent",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^count to 42\"> <span _=\"on click put ^count into me\">0</span></div>",
|
|
|
|
|
"action": "find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "child writes ^var and parent sees it",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^count to 0\"> <button _=\"on click set ^count to 99\">set</button> <span _=\"on click put ^count into me\">0</span></div>",
|
|
|
|
|
"action": "find('button').click(); find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "deeply nested child reads ^var from grandparent",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^name to 'alice'\"> <div> <div> <span _=\"on click put ^name into me\">empty</span> </div> </div></div>",
|
|
|
|
|
"action": "find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "closest ancestor wins (shadowing)",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^color to 'red'\"> <div _=\"init set ^color to 'blue'\"> <span _=\"on click put ^color into me\">empty</span> </div></div>",
|
|
|
|
|
"action": "find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "sibling subtrees have independent ^vars",
|
|
|
|
|
"html": "<div id=\"a\" _=\"init set ^val to 'A'\"> <span _=\"on click put ^val into me\">empty</span></div><div id=\"b\" _=\"init set ^val to 'B'\"> <span _=\"on click put ^val into me\">empty</span></div>",
|
|
|
|
|
"action": "find('#a span').click(); find('#b span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "write to ^var not found anywhere creates on current element",
|
|
|
|
|
"html": "<div id=\"el\"> <button _=\"on click set ^newvar to 'created' then put ^newvar into next <span/>\">go</button> <span>empty</span></div>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "child write updates the ancestor, not a local copy",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^shared to 0\"> <button _=\"on click set ^shared to 10\">set</button> <span _=\"on click put ^shared into me\">0</span></div>",
|
|
|
|
|
"action": "find('button').click(); find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "increment works on inherited var",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^count to 0\"> <button _=\"on click increment ^count\" <span _=\"on click put ^count into me\">0</span></div>",
|
|
|
|
|
"action": "find('button').click(); find('button').click(); find('button').click(); find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "dom keyword works as scope modifier",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set dom count to 42\"> <span _=\"on click put dom count into me\">0</span></div>",
|
|
|
|
|
"action": "find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "set ^var on explicit element",
|
|
|
|
|
"html": "<div id=\"el\" class=\"store\"> <button _=\"on click set ^data on closest .store to 'hello'\">set</button> <span _=\"on click put ^data on closest .store into me\">read</span></div>",
|
|
|
|
|
"action": "find('button').click(); find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "on clause targets a specific ancestor",
|
|
|
|
|
"html": "<div id=\"el\" class=\"outer\" _=\"init set ^outerVal to 'outer'\"> <div class=\"inner\" _=\"init set ^innerVal to 'inner'\"> <span _=\"on click put ^outerVal on closest .outer into me\">read</span> </div></div>",
|
|
|
|
|
"action": "find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "on clause with id reference",
|
|
|
|
|
"html": "<div id=\"state-holder\"></div><button _=\"on click set ^count on #state-holder to 99\">set</button><span _=\"on click put ^count on #state-holder into me\">read</span>",
|
|
|
|
|
"action": "find('button').click(); find('span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "when reacts to ^var changes",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^count to 0\"> <button _=\"on click increment ^count\" <output _=\"when ^count changes put it into me\">0</output></div>",
|
|
|
|
|
"action": "find('button').click(); find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "always reacts to ^var changes",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^name to 'alice'\"> <button _=\"on click set ^name to 'bob'\">rename</button> <output _=\"live put 'Hello </div>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "multiple children react to same ^var",
|
|
|
|
|
"html": "<div _=\"init set ^color to 'red'\"> <button _=\"on click set ^color to 'blue'\">change</button> <span id=\"a\" _=\"when ^color changes put it into me\"></span> <span id=\"b\" _=\"when ^color changes put it into me\"></span></div>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "sibling subtrees react independently with ^var",
|
|
|
|
|
"html": "<div id=\"a\" _=\"init set ^val to 0\"> <button _=\"on click increment ^val\" <output _=\"when ^val changes put it into me\">0</output></div><div id=\"b\" _=\"init set ^val to 0\"> <button _=\"on click increment ^val\" <output _=\"when ^val changes put it into me\">0</output></div>",
|
|
|
|
|
"action": "find('#a button').click(); find('#a button').click(); find('#b button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "bind works with ^var",
|
|
|
|
|
"html": "<div id=\"el\" _=\"init set ^search to ''\"> <input type=\"text\" _=\"bind ^search and my value\" /> <output _=\"when ^search changes put it into me\"></output></div>",
|
|
|
|
|
"action": "find('input').fill('hello')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "dom-scope",
|
|
|
|
|
"name": "derived ^var chains reactively",
|
|
|
|
|
"html": "<div _=\"init set ^price to 10 then set ^qty to 2 then set ^total to 20\"> <span _=\"when ^price changes set ^total to (^price * ^qty)\"></span> <span _=\"when ^qty changes set ^total to (^price * ^qty)\"></span> <output _=\"when ^total changes put it into me\"></output> <button id=\"price-btn\" _=\"on click set ^price to 25\">set price</button> <button id=\"qty-btn\" _=\"on click set ^qty to 5\">set qty</button></div>",
|
|
|
|
|
"action": "find('#price-btn').click(); find('#qty-btn').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "component",
|
|
|
|
|
"name": "processes _ on inner elements",
|
|
|
|
|
"html": "\n\t\t\t<template component=\"test-inner\" _=\"init set ^count to 0\">\n\t\t\t\t<button _=\"on click increment ^count then put ^count into the next <span/>\">+</button>\n\t\t\t\t<span>0</span>\n\t\t\t</template>\n\t\t\t<test-inner></test-inner>\n\t\t",
|
|
|
|
|
"action": "find('test-inner button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "component",
|
|
|
|
|
"name": "supports multiple independent instances",
|
|
|
|
|
"html": "\n\t\t\t<template component=\"test-multi\" _=\"init set ^count to 0\">\n\t\t\t\t<button _=\"on click increment ^count then put ^count into the next <span/>\">+</button>\n\t\t\t\t<span>0</span>\n\t\t\t</template>\n\t\t\t<test-multi id=\"a\"></test-multi>\n\t\t\t<test-multi id=\"b\"></test-multi>\n\t\t",
|
|
|
|
|
"action": "find('#a button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "component",
|
|
|
|
|
"name": "blocks processing of inner hyperscript until render",
|
|
|
|
|
"html": "\n\t\t\t<template component=\"test-block\" _=\"init set ^msg to 'ready'\">\n\t\t\t\t<span _=\"on click put ^msg into me\">click me</span>\n\t\t\t</template>\n\t\t\t<test-block></test-block>\n\t\t",
|
|
|
|
|
"action": "find('test-block span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "component",
|
|
|
|
|
"name": "does not process slotted _ attributes prematurely",
|
|
|
|
|
"html": "\n\t\t\t<div _=\"init set ^x to 42\">\n\t\t\t\t<template component=\"test-slot-hs\">\n\t\t\t\t\t<div class=\"wrap\"><slot/></div>\n\t\t\t\t</template>\n\t\t\t\t<test-slot-hs>\n\t\t\t\t\t<span _=\"on click put ^x into me\">before</span>\n\t\t\t\t</test-slot-hs>\n\t\t\t</div>\n\t\t",
|
|
|
|
|
"action": "find('test-slot-hs span').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "add",
|
|
|
|
|
"name": "when clause sets result to matched elements",
|
|
|
|
|
"html": "<div id='trigger' _='on click add .foo to .item when it matches .yes then if the result is empty show #none else hide #none'></div><div id='d1' class='item yes'></div><div id='d2' class='item'></div><div id='none' style='display:none'></div>",
|
|
|
|
|
"action": "find('#trigger').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "add",
|
|
|
|
|
"name": "when clause result is empty when nothing matches",
|
|
|
|
|
"html": "<div id='trigger' _='on click add .foo to .item when it matches .nope then if the result is empty remove @hidden from #none'></div><div id='d1' class='item'></div><div id='none' hidden></div>",
|
|
|
|
|
"action": "find('#trigger').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "can default possessive properties",
|
|
|
|
|
"html": "<div id='d1' _=\\\"on click default #d1's foo to 'bar' then put #d1's foo into me\\\"></div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "can default of-expression properties",
|
|
|
|
|
"html": "<div id='d1' _=\\\"on click default foo of me to 'bar' then put my foo into me\\\"></div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "can default array elements",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click set arr to [null, null] then default arr[0] to 'yes' then put arr[0] into me\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "default array element respects existing value",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click set arr to ['existing', null] then default arr[0] to 'new' then put arr[0] into me\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "default preserves zero",
|
|
|
|
|
"html": "<div id=\"el\" _='on click set x to 0 then default x to 10 then put x into me'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "default overwrites empty string",
|
|
|
|
|
"html": "<div id=\"el\" _='on click set x to \"\" then default x to \"fallback\" then put x into me'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "default preserves false",
|
|
|
|
|
"html": "<div id=\"el\" _='on click set x to false then default x to true then put x into me'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "can default style ref when unset",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click default *background-color to 'red'\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "default",
|
|
|
|
|
"name": "default style ref preserves existing value",
|
|
|
|
|
"html": "<div id=\"el\" style=\"color: blue\" _=\"on click default *color to 'red'\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "hide",
|
|
|
|
|
"name": "can filter hide via the when clause",
|
|
|
|
|
"html": "<div id='trigger' _='on click hide <div/> in me when it matches .hideable'> <div id='d1' class='hideable'></div> <div id='d2'></div></div>",
|
|
|
|
|
"action": "find('#trigger').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "increment",
|
|
|
|
|
"name": "can increment an array element",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click set arr to [10, 20, 30] then increment arr[1] then put arr[1] into me\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "increment",
|
|
|
|
|
"name": "can decrement an array element",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click set arr to [10, 20, 30] then decrement arr[1] then put arr[1] into me\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "increment",
|
|
|
|
|
"name": "can increment a possessive property",
|
|
|
|
|
"html": "<div id=\"d1\" _=\"on click increment #d1's innerHTML\">5</div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "increment",
|
|
|
|
|
"name": "can increment a property of expression",
|
|
|
|
|
"html": "<div id=\"d1\" _=\"on click increment innerHTML of #d1\">5</div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "increment",
|
|
|
|
|
"name": "can increment a style ref",
|
|
|
|
|
"html": "<div id=\"el\" _=\"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')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "js",
|
|
|
|
|
"name": "handles rejected promises without hanging",
|
|
|
|
|
"html": "<div id=\"el\" _='on click js return Promise.reject(\\\"boom\\\") end catch e put e into my.innerHTML'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "put",
|
|
|
|
|
"name": "put null into attribute removes it",
|
|
|
|
|
"html": "<div id='d1' foo='bar' _='on click put null into @foo'></div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "remove",
|
|
|
|
|
"name": "can filter class removal via the when clause",
|
|
|
|
|
"html": "<div id='trigger' _='on click remove .highlight from .item when it matches .old'></div><div id='d1' class='item old highlight'></div><div id='d2' class='item highlight'></div>",
|
|
|
|
|
"action": "find('#trigger').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "basic raw for loop with null works",
|
|
|
|
|
"html": "<div id=\"el\" _='on click for x in null put x at end of me end'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "basic property for loop works",
|
|
|
|
|
"html": "<div id=\"el\" _='on click set x to {foo:1, bar:2, baz:3} for prop in x put x[prop] at end of me end'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "bottom-tested repeat until",
|
|
|
|
|
"html": "<div id=\"el\" _='on click set x to 0 repeat set x to until x is 3 end put x into me'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "bottom-tested repeat while",
|
|
|
|
|
"html": "<div id=\"el\" _='on click set x to 0 repeat set x to while x < 3 end put x into me'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "bottom-tested loop always runs at least once",
|
|
|
|
|
"html": "<div id=\"el\" _='on click set x to 0 repeat set x to until true end put x into me'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "break exits a simple repeat loop",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click\n\t\t\t\tset x to 0\n\t\t\t\trepeat 10 times\n\t\t\t\t\tset x to x + 1\n\t\t\t\t\tif x is 3 break end\n\t\t\t\tend\n\t\t\t\tput x into me\n\t\t\t\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "continue skips rest of iteration in simple repeat loop",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click\n\t\t\t\trepeat for x in [1, 2, 3, 4, 5]\n\t\t\t\t\tif x is 3 continue end\n\t\t\t\t\tput x at end of me\n\t\t\t\tend\n\t\t\t\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "break exits a for-in loop",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click\n\t\t\t\trepeat for x in [1, 2, 3, 4, 5]\n\t\t\t\t\tif x is 4 break end\n\t\t\t\t\tput x at end of me\n\t\t\t\tend\n\t\t\t\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "break exits a while loop",
|
|
|
|
|
"html": "<div id=\"el\" _=\"on click\n\t\t\t\tset x to 0\n\t\t\t\trepeat while x < 100\n\t\t\t\t\tset x to x + 1\n\t\t\t\t\tif x is 5 break end\n\t\t\t\tend\n\t\t\t\tput x into me\n\t\t\t\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "repeat",
|
|
|
|
|
"name": "for loop over undefined skips without error",
|
|
|
|
|
"html": "<div id=\"el\" _='on click repeat for x in doesNotExist put x at end of me end then put \\\"done\\\" into me'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "settle",
|
|
|
|
|
"name": "can settle a collection of elements",
|
|
|
|
|
"html": "<div class='item'></div><div class='item'></div><div id='trigger' _='on click settle <.item/> then add .done to <.item/>'></div>",
|
|
|
|
|
"action": "find('#trigger').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "show",
|
|
|
|
|
"name": "the result in a when clause refers to previous command result, not element being tested",
|
|
|
|
|
"html": "<div _=\\\"on click get 'found' show <span/> in me when the result is 'found'\\\"><span id='s1' style='display:none'>A</span><span id='s2' style='display:none'>B</span></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "show",
|
|
|
|
|
"name": "the result after show...when is the matched elements",
|
|
|
|
|
"html": "<div _=\\\"on click show <p/> in me when its textContent is 'yes' if the result is empty put 'none' into #out else put 'some' into #out\\\"><p style='display:none'>yes</p><p style='display:none'>no</p><span id='out'>--</span></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "toggle",
|
|
|
|
|
"name": "can toggle visibility",
|
|
|
|
|
"html": "<div id=\"el\" _='on click toggle *visibility'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click'); find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "toggle",
|
|
|
|
|
"name": "can toggle opacity w/ my",
|
|
|
|
|
"html": "<div id=\"el\" _='on click toggle my *opacity'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click'); find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "toggle",
|
|
|
|
|
"name": "can toggle visibility w/ my",
|
|
|
|
|
"html": "<div id=\"el\" _='on click toggle my *visibility'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click'); find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "toggle",
|
|
|
|
|
"name": "can toggle *display between two values",
|
|
|
|
|
"html": "<div id=\"el\" style='display:none' _=\\\"on click toggle *display of me between 'none' and 'flex'\\\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click'); find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "toggle",
|
|
|
|
|
"name": "can toggle *opacity between three values",
|
|
|
|
|
"html": "<div id=\"el\" style='opacity:0' _=\\\"on click toggle *opacity of me between '0', '0.5' and '1'\\\"></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click'); find('div').dispatchEvent('click'); find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "on",
|
|
|
|
|
"name": "caught exceptions do not trigger 'exception' event",
|
|
|
|
|
"html": "<button id=\"el\" _='on click put \\\"foo\\\" into me then throw \\\"bar\\\" catch e log e on exception(error) put error into me'></button>",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "on",
|
|
|
|
|
"name": "rethrown exceptions trigger 'exception' event",
|
|
|
|
|
"html": "<button id=\"el\" _='on click put \\\"foo\\\" into me then throw \\\"bar\\\" catch e throw e on exception(error) put error into me'></button>",
|
|
|
|
|
"action": "find('button').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "on",
|
|
|
|
|
"name": "can ignore when target doesn\\'t exist",
|
|
|
|
|
"html": "<div id=\"el\" _=' \ton click from #doesntExist \t\tthrow \\\"bar\\\" \ton click \t\tput \\\"clicked\\\" into me\t'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "parser",
|
|
|
|
|
"name": "can have comments in attributes (triple dash)",
|
|
|
|
|
"html": "<div id=\"el\" _='on click put \\\"clicked\\\" into my.innerHTML ---put some content into the div...'></div>",
|
|
|
|
|
"action": "find('div').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "parser",
|
|
|
|
|
"name": "element-level isolation still works with error recovery",
|
|
|
|
|
"html": "<div><div id='d1' _='on click blargh end on mouseenter also_bad'></div><div id='d2' _='on click put \\\"clicked\\\" into my.innerHTML'></div></div>",
|
|
|
|
|
"action": "find('#d2').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "scoping",
|
|
|
|
|
"name": "element scoped variables span features w/short syntax",
|
|
|
|
|
"html": "<div id='d1' _='on click 1 set :x to 10 on click 2 set @out to :x'></div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click'); find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "closest",
|
|
|
|
|
"name": "closest does not consume a following where clause",
|
|
|
|
|
"html": "<table><tr><td><input type='checkbox' class='cb'><input type='checkbox' class='cb'><input id='master' type='checkbox' _=\\\"set :others to <input[type=checkbox]/> in the closest <table/> where it is not me on click put :others.length into #out\\\"></td></tr></table><div id='out'></div>",
|
|
|
|
|
"action": "find('#master').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "comparisonOperator",
|
|
|
|
|
"name": "is a works with instanceof fallback",
|
|
|
|
|
"html": "<div id='d1' _='on click if I am a Element put \\\"yes\\\" into me'></div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "comparisonOperator",
|
|
|
|
|
"name": "is a Node works via instanceof",
|
|
|
|
|
"html": "<div id='d1' _='on click if I am a Node put \\\"yes\\\" into me'></div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "comparisonOperator",
|
|
|
|
|
"name": "is not a works with instanceof fallback",
|
|
|
|
|
"html": "<div id='d1' _='on click if \\\"hello\\\" is not a Element put \\\"yes\\\" into me'></div>",
|
|
|
|
|
"action": "find('#d1').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "comparisonOperator",
|
|
|
|
|
"name": "I precede works",
|
|
|
|
|
"html": "<div id='a' _=\\\"on click if I precede #b put 'yes' into me\\\"></div><div id='b'></div>",
|
|
|
|
|
"action": "find('#a').dispatchEvent('click')",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"category": "no",
|
|
|
|
|
"name": "no with where on DOM elements",
|
|
|
|
|
"html": "<div id='box'><span class='a'>A</span><span class='b'>B</span></div><button _=\\\"on click if no <span/> in #box where it matches .c then put 'none' into #out else put 'found' into #out\\\">go</button><div id='out'></div>",
|
|
|
|
|
"action": "find('button').click()",
|
|
|
|
|
"checks": [],
|
|
|
|
|
"async": true
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|