chore: failing test for derived + fork + block

failing-test-derived-fork
paoloricciuti 2 days ago
parent b9c7e45408
commit fc6aedd14e

@ -0,0 +1,19 @@
import { flushSync } from 'svelte';
import { test } from '../../test';
export default test({
async test({ assert, target }) {
const [fork, update] = target.querySelectorAll('button');
flushSync(() => {
fork.click();
});
flushSync(() => {
update.click();
});
const p = target.querySelector('p');
assert.equal(p?.textContent, 'one');
}
});

@ -0,0 +1,23 @@
<script>
import { fork, flushSync } from "svelte";
let state = $state(0);
let count = $derived(state);
let forked;
</script>
<button onclick={()=>{
forked = fork(()=>{
state++;
})
}}></button>
<button onclick={()=>{
state++;
}}></button>
{#if count === 1}
<p>one</p>
{/if}
Loading…
Cancel
Save