mirror of https://github.com/sveltejs/svelte
alias #component in hoisted event handlers - fixes #699
parent
b3dc57d18d
commit
2131b28630
@ -0,0 +1,18 @@
|
||||
export default {
|
||||
data: {
|
||||
foo: [1],
|
||||
a: 42
|
||||
},
|
||||
|
||||
html: `
|
||||
<button>click me</button>
|
||||
`,
|
||||
|
||||
test (assert, component, target, window) {
|
||||
const button = target.querySelector('button');
|
||||
const event = new window.MouseEvent('click');
|
||||
|
||||
button.dispatchEvent(event);
|
||||
assert.equal(component.snapshot, 42);
|
||||
}
|
||||
};
|
@ -0,0 +1,13 @@
|
||||
{{#each foo as bar}}
|
||||
<button on:click='baz(a)'>click me</button>
|
||||
{{/each}}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
baz(a) {
|
||||
this.snapshot = a;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue