mirror of https://github.com/sveltejs/svelte
store prop names as $$.props, prevent leaky bindings. fixes #2222
parent
07ceb2e767
commit
9ea663e312
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
let count = 0;
|
||||
</script>
|
||||
|
||||
<button on:click='{() => count += 1}'>{count}</button>
|
@ -0,0 +1,27 @@
|
||||
export default {
|
||||
html: `
|
||||
<button>0</button>
|
||||
<p>count: undefined</p>
|
||||
`,
|
||||
|
||||
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, undefined);
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<button>1</button>
|
||||
<p>count: undefined</p>
|
||||
`);
|
||||
|
||||
await button.dispatchEvent(click);
|
||||
|
||||
assert.equal(component.x, undefined);
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<button>2</button>
|
||||
<p>count: undefined</p>
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import Counter from './Counter.svelte';
|
||||
|
||||
let x;
|
||||
</script>
|
||||
|
||||
<Counter bind:count={x}/>
|
||||
<p>count: {x}</p>
|
Loading…
Reference in new issue