mirror of https://github.com/sveltejs/svelte
event propagation shorthand for elements (#638)
parent
5c4905a595
commit
51af8c29e0
@ -0,0 +1,13 @@
|
||||
export default {
|
||||
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.ok(component.clicked);
|
||||
}
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
<button on:click>click me</button>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
oncreate () {
|
||||
this.on('click', () => {
|
||||
this.clicked = true;
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue