mirror of https://github.com/sveltejs/svelte
Merge pull request #613 from sveltejs/gh-612
Sanitize event name in handler function namepull/617/head
commit
4cd5303831
@ -0,0 +1,21 @@
|
||||
export default {
|
||||
html: `
|
||||
<div>toggle</div>
|
||||
`,
|
||||
|
||||
test ( assert, component, target, window ) {
|
||||
const div = target.querySelector( 'div' );
|
||||
const event = new window.MouseEvent( 'some-event' );
|
||||
|
||||
div.dispatchEvent( event );
|
||||
assert.htmlEqual( target.innerHTML, `
|
||||
<div>toggle</div>
|
||||
<p>hello!</p>
|
||||
` );
|
||||
|
||||
div.dispatchEvent( event );
|
||||
assert.htmlEqual( target.innerHTML, `
|
||||
<div>toggle</div>
|
||||
` );
|
||||
}
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
<div on:some-event='set({ visible: !visible })'>toggle</div>
|
||||
|
||||
{{#if visible}}
|
||||
<p>hello!</p>
|
||||
{{/if}}
|
Loading…
Reference in new issue