mirror of https://github.com/sveltejs/svelte
handle shorthand properties in expressions (fixes #296)
parent
dc4e929b77
commit
796af04cac
@ -0,0 +1,27 @@
|
||||
export default {
|
||||
html: `<button>click me</button>`,
|
||||
|
||||
data: {
|
||||
foo: 42
|
||||
},
|
||||
|
||||
test ( assert, component, target, window ) {
|
||||
const event = new window.MouseEvent( 'click' );
|
||||
const button = target.querySelector( 'button' );
|
||||
|
||||
let count = 0;
|
||||
let number = null;
|
||||
|
||||
component.on( 'foo', obj => {
|
||||
count++;
|
||||
number = obj.foo;
|
||||
});
|
||||
|
||||
button.dispatchEvent( event );
|
||||
|
||||
assert.equal( count, 1 );
|
||||
assert.equal( number, 42 );
|
||||
|
||||
component.teardown();
|
||||
}
|
||||
};
|
@ -0,0 +1 @@
|
||||
<button on:click='fire("foo", { foo })'>click me</button>
|
Loading…
Reference in new issue