mirror of https://github.com/sveltejs/svelte
Merge pull request #526 from sveltejs/gh-523
include destroy as valid built-in method for event handlerspull/533/head
commit
9ae2540c11
@ -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