mirror of https://github.com/sveltejs/svelte
parent
3258779fa7
commit
073c8762ef
@ -0,0 +1,21 @@
|
||||
export default {
|
||||
data: {
|
||||
items: [
|
||||
'whatever'
|
||||
],
|
||||
foo: 'wrong',
|
||||
bar: 'right'
|
||||
},
|
||||
|
||||
test(assert, component, target, window) {
|
||||
const button = target.querySelector('button');
|
||||
const event = new window.MouseEvent('click');
|
||||
|
||||
button.dispatchEvent(event);
|
||||
assert.equal(component.get().foo, 'right');
|
||||
|
||||
component.set({ bar: 'left' });
|
||||
button.dispatchEvent(event);
|
||||
assert.equal(component.get().foo, 'left');
|
||||
}
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
{#each items as item}
|
||||
<button on:click='set({ foo: bar })'>{item}</button>
|
||||
{/each}
|
||||
|
||||
<p>foo: {foo}</p>
|
Loading…
Reference in new issue