mirror of https://github.com/sveltejs/svelte
parent
6da02329a3
commit
80341d5521
@ -0,0 +1,40 @@
|
|||||||
|
import { writable } from '../../../../store.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
skip: true,
|
||||||
|
|
||||||
|
props: {
|
||||||
|
things: [
|
||||||
|
writable('a'),
|
||||||
|
writable('b'),
|
||||||
|
writable('c')
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `
|
||||||
|
<button>a</button>
|
||||||
|
<button>b</button>
|
||||||
|
<button>c</button>
|
||||||
|
`,
|
||||||
|
|
||||||
|
async test({ assert, component, target, window }) {
|
||||||
|
const buttons = target.querySelectorAll('button');
|
||||||
|
const click = new window.MouseEvent('click');
|
||||||
|
|
||||||
|
await buttons[1].dispatchEvent(click);
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<button>a</button>
|
||||||
|
<button>B</button>
|
||||||
|
<button>c</button>
|
||||||
|
`);
|
||||||
|
|
||||||
|
await component.things[1].set('d');
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<button>d</button>
|
||||||
|
<button>B</button>
|
||||||
|
<button>c</button>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
export let things;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each things as thing}
|
||||||
|
<button on:click="{() => thing.update(n => n.toUpperCase())}">{$thing}</button>
|
||||||
|
{/each}
|
Loading…
Reference in new issue