From 90d4b91ef8028fcedad194bb64d9df2859363b73 Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sun, 29 Sep 2019 16:26:45 +0200 Subject: [PATCH] tests: add test that exposes #3634 --- .../reactive-compound-operator/_config.js | 29 +++++++++++++++++++ .../reactive-compound-operator/main.svelte | 9 ++++++ 2 files changed, 38 insertions(+) create mode 100644 test/runtime/samples/reactive-compound-operator/_config.js create mode 100644 test/runtime/samples/reactive-compound-operator/main.svelte diff --git a/test/runtime/samples/reactive-compound-operator/_config.js b/test/runtime/samples/reactive-compound-operator/_config.js new file mode 100644 index 000000000000..7ec5e0fb9d51 --- /dev/null +++ b/test/runtime/samples/reactive-compound-operator/_config.js @@ -0,0 +1,29 @@ +export default { + skip_if_ssr: true, // TODO delete this line, once binding works + + html: ` + +

count: 0

+ `, + + async test({ assert, component, target, window }) { + const click = new window.MouseEvent('click'); + const button = target.querySelector('button'); + + await button.dispatchEvent(click); + + assert.equal(component.x, 2); + assert.htmlEqual(target.innerHTML, ` + +

count: 2

+ `); + + await button.dispatchEvent(click); + + assert.equal(component.x, 6); + assert.htmlEqual(target.innerHTML, ` + +

count: 6

+ `); + } +}; diff --git a/test/runtime/samples/reactive-compound-operator/main.svelte b/test/runtime/samples/reactive-compound-operator/main.svelte new file mode 100644 index 000000000000..508cc8d9a4d6 --- /dev/null +++ b/test/runtime/samples/reactive-compound-operator/main.svelte @@ -0,0 +1,9 @@ + + + +

count: {x}