mirror of https://github.com/sveltejs/svelte
include destroy as valid built-in method for event handlers (fixes #523)
parent
9427f63b95
commit
754688cf48
@ -0,0 +1,20 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<button>destroy</button>
|
||||||
|
`,
|
||||||
|
|
||||||
|
test ( assert, component, target, window ) {
|
||||||
|
const button = target.querySelector( 'button' );
|
||||||
|
const event = new window.MouseEvent( 'click' );
|
||||||
|
|
||||||
|
let destroyed = false;
|
||||||
|
component.on( 'destroy', () => {
|
||||||
|
destroyed = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
button.dispatchEvent( event );
|
||||||
|
assert.htmlEqual( target.innerHTML, `` );
|
||||||
|
|
||||||
|
assert.ok( destroyed );
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
<button on:click='destroy()'>destroy</button>
|
Loading…
Reference in new issue