mirror of https://github.com/sveltejs/svelte
defer hoisting until after the template is walked - fixes #2005
parent
82f4ae6643
commit
c9301dc9f7
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
let count = 0;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click="{() => count += 1}">{count}</button>
|
@ -0,0 +1,14 @@
|
|||||||
|
export default {
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const btns = target.querySelectorAll('button');
|
||||||
|
const event = new window.MouseEvent('click');
|
||||||
|
|
||||||
|
await btns[0].dispatchEvent(event);
|
||||||
|
await btns[0].dispatchEvent(event);
|
||||||
|
await btns[1].dispatchEvent(event);
|
||||||
|
await btns[1].dispatchEvent(event);
|
||||||
|
await btns[1].dispatchEvent(event);
|
||||||
|
|
||||||
|
assert.equal(btns[1].innerHTML, '3');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,6 @@
|
|||||||
|
<script>
|
||||||
|
import Widget from './Widget.html';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Widget />
|
||||||
|
<Widget />
|
Loading…
Reference in new issue