mirror of https://github.com/sveltejs/svelte
parent
e78a525e3f
commit
1eab084122
@ -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,16 @@
|
||||
<script>
|
||||
export let x = 0;
|
||||
|
||||
function foo() {
|
||||
({ x } = { x: 1 });
|
||||
}
|
||||
|
||||
function bar() {
|
||||
([x] = [2]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button on:click={foo}>foo</button>
|
||||
<button on:click={bar}>bar</button>
|
||||
|
||||
<p>x: {x}</p>
|
Loading…
Reference in new issue