mirror of https://github.com/sveltejs/svelte
parent
43f82af4a8
commit
963f6e7aa6
@ -0,0 +1,15 @@
|
|||||||
|
export default {
|
||||||
|
html: `
|
||||||
|
<button>Click me</button>
|
||||||
|
`,
|
||||||
|
|
||||||
|
async test({ assert, target, window }) {
|
||||||
|
const event = new window.MouseEvent('click');
|
||||||
|
const button = target.querySelector('button');
|
||||||
|
|
||||||
|
await button.dispatchEvent(event);
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<button>4</button>
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,10 @@
|
|||||||
|
<script>
|
||||||
|
let num = 2;
|
||||||
|
$: square = num * num;
|
||||||
|
|
||||||
|
function onClick() {
|
||||||
|
this.innerHTML = square;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={onClick}>Click me</button>
|
Loading…
Reference in new issue