From b4bb38666780e4751c155b4349976663f522587f Mon Sep 17 00:00:00 2001 From: Conduitry Date: Sun, 9 Feb 2020 09:14:46 -0500 Subject: [PATCH] add test --- .../_config.js | 31 +++++++++++++++++++ .../main.svelte | 14 +++++++++ 2 files changed, 45 insertions(+) create mode 100644 test/runtime/samples/instrumentation-update-expression/_config.js create mode 100644 test/runtime/samples/instrumentation-update-expression/main.svelte diff --git a/test/runtime/samples/instrumentation-update-expression/_config.js b/test/runtime/samples/instrumentation-update-expression/_config.js new file mode 100644 index 0000000000..cc33422f6f --- /dev/null +++ b/test/runtime/samples/instrumentation-update-expression/_config.js @@ -0,0 +1,31 @@ +export default { + html: ` +

0

+ + +

0

+ + + `, + async test({ assert, target, window }) { + const [foo, bar] = target.querySelectorAll('p'); + const [button1, button2, button3, button4] = target.querySelectorAll('button'); + const event = new window.MouseEvent('click'); + + await button1.dispatchEvent(event); + assert.equal(foo.innerHTML, '1'); + assert.equal(bar.innerHTML, '0'); + + await button2.dispatchEvent(event); + assert.equal(foo.innerHTML, '2'); + assert.equal(bar.innerHTML, '0'); + + await button3.dispatchEvent(event); + assert.equal(foo.innerHTML, '2'); + assert.equal(bar.innerHTML, '1'); + + await button4.dispatchEvent(event); + assert.equal(foo.innerHTML, '2'); + assert.equal(bar.innerHTML, '2'); + } +}; diff --git a/test/runtime/samples/instrumentation-update-expression/main.svelte b/test/runtime/samples/instrumentation-update-expression/main.svelte new file mode 100644 index 0000000000..0672f6330d --- /dev/null +++ b/test/runtime/samples/instrumentation-update-expression/main.svelte @@ -0,0 +1,14 @@ + + +

{foo}

+ + + + +

{bar.bar}

+ + +