mirror of https://github.com/sveltejs/svelte
fix: improve global transition handling of effect cleardown (#10469)
* fix: improve global transition handling of effect cleardownpull/10474/head
parent
1b56a3219c
commit
667ffb7a39
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: improve global transition handling of effect cleardown
|
@ -0,0 +1,10 @@
|
||||
<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,20 @@
|
||||
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>`);
|
||||
|
||||
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…
Reference in new issue