mirror of https://github.com/sveltejs/svelte
parent
2e02868ef1
commit
772fb96d14
@ -0,0 +1,18 @@
|
|||||||
|
import { ok, test } from '../../test';
|
||||||
|
import { flushSync } from 'svelte';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
compileOptions: {
|
||||||
|
hmr: true,
|
||||||
|
compatibility: {
|
||||||
|
componentApi: 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async test({ assert, target, logs }) {
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
btn?.click();
|
||||||
|
|
||||||
|
assert.deepEqual(logs, ['event']);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,15 @@
|
|||||||
|
<script>
|
||||||
|
import Test from './test.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={()=>{
|
||||||
|
const target = document.createElement('div');
|
||||||
|
const test = new Test({
|
||||||
|
target,
|
||||||
|
});
|
||||||
|
test.$on('event', () => {
|
||||||
|
console.log('event');
|
||||||
|
});
|
||||||
|
|
||||||
|
target.querySelector("button").click();
|
||||||
|
}}></button>
|
@ -0,0 +1,7 @@
|
|||||||
|
<script>
|
||||||
|
import { createEventDispatcher } from "svelte";
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button on:click={() => dispatch("event")}></button>
|
Loading…
Reference in new issue