mirror of https://github.com/sveltejs/svelte
prevent duplicate declaration of store values - fixes #1883
parent
d6552025e4
commit
dcc1996aef
@ -0,0 +1,28 @@
|
|||||||
|
import { writable } from '../../../../store.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
count: writable(0)
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `
|
||||||
|
<button>count 0</button>
|
||||||
|
`,
|
||||||
|
|
||||||
|
async test({ assert, component, target, window }) {
|
||||||
|
const button = target.querySelector('button');
|
||||||
|
const click = new window.MouseEvent('click');
|
||||||
|
|
||||||
|
await button.dispatchEvent(click);
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<button>count 1</button>
|
||||||
|
`);
|
||||||
|
|
||||||
|
await component.count.set(42);
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<button>count 42</button>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
<button on:click="{() => count.update(n => n + 1)}">count {$count}</button>
|
Loading…
Reference in new issue