mirror of https://github.com/sveltejs/svelte
parent
1eab084122
commit
a534c66d5b
@ -0,0 +1,29 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<button>foo</button>
|
||||||
|
<button>bar</button>
|
||||||
|
|
||||||
|
<p>x: 0</p>
|
||||||
|
`,
|
||||||
|
|
||||||
|
async test({ assert, component, target, window }) {
|
||||||
|
const buttons = target.querySelectorAll('button');
|
||||||
|
const click = new window.MouseEvent('click');
|
||||||
|
|
||||||
|
await buttons[0].dispatchEvent(click);
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<button>foo</button>
|
||||||
|
<button>bar</button>
|
||||||
|
|
||||||
|
<p>x: 1</p>
|
||||||
|
`);
|
||||||
|
|
||||||
|
await buttons[1].dispatchEvent(click);
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<button>foo</button>
|
||||||
|
<button>bar</button>
|
||||||
|
|
||||||
|
<p>x: 2</p>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,8 @@
|
|||||||
|
<script>
|
||||||
|
let x = 0;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click="{() => ({ x } = { x: 1 })}">foo</button>
|
||||||
|
<button on:click="{() => ([x] = [2])}">bar</button>
|
||||||
|
|
||||||
|
<p>x: {x}</p>
|
Loading…
Reference in new issue