fix: improve global transition handling of effect cleardown

pull/10469/head
Dominic Gannaway 3 years ago
parent 8df77342c2
commit 85aa07428d

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: improve global transition handling of effect cleardown

@ -0,0 +1,12 @@
<script>
import { fade } from 'svelte/transition';
let show = $state(true);
</script>
<h1>Outside</h1>
{#if show}
<button onclick={()=> show = false} transition:fade|global={{ duration: 100 }}>Hide</button>
{/if}

@ -0,0 +1,21 @@
import { test } from '../../test';
import { flushSync } from 'svelte';
export default test({
async test({ assert, target, raf }) {
const btn = target.querySelector('button');
raf.tick(0);
flushSync(() => {
btn?.click();
});
assert.htmlEqual(target.innerHTML, `<h1>Outside</h1><button>Hide</button>`);
debugger;
raf.tick(100);
assert.htmlEqual(target.innerHTML, `<h1>Outside</h1>`);
}
});

@ -0,0 +1,5 @@
<script>
import Component from "./Component.svelte"
</script>
<svelte:component this={Component} />
Loading…
Cancel
Save