mirror of https://github.com/sveltejs/svelte
parent
497ba9bf04
commit
bfaaa6d2a4
@ -0,0 +1,9 @@
|
|||||||
|
<script>
|
||||||
|
let clicked = "False";
|
||||||
|
export function click() {
|
||||||
|
clicked = "True";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<p>{clicked}</p>
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
export default {
|
||||||
|
async test({ assert, target, window }) {
|
||||||
|
const button = target.querySelector('button');
|
||||||
|
const p = target.querySelector('p');
|
||||||
|
const eventClick = new window.MouseEvent('click');
|
||||||
|
|
||||||
|
await button.dispatchEvent(eventClick);
|
||||||
|
assert.htmlEqual(p.innerHTML, 'True');
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
import Foo from './Foo.svelte';
|
||||||
|
export let foo;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={foo.click} />
|
||||||
|
<Foo bind:this={foo} />
|
||||||
Loading…
Reference in new issue