mirror of https://github.com/sveltejs/svelte
Merge pull request #2703 from EmilTholin/hoisting-injected-reactive-vars
Don't hoist functions dependent on injected reactive variablespull/2726/head
commit
c4e05f2086
@ -0,0 +1,15 @@
|
||||
export default {
|
||||
html: `
|
||||
<button>Click me</button>
|
||||
`,
|
||||
|
||||
async test({ assert, target, window }) {
|
||||
const event = new window.MouseEvent('click');
|
||||
const button = target.querySelector('button');
|
||||
|
||||
await button.dispatchEvent(event);
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<button>4</button>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
let num = 2;
|
||||
$: square = num * num;
|
||||
|
||||
function onClick() {
|
||||
this.innerHTML = square;
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={onClick}>Click me</button>
|
Loading…
Reference in new issue