mirror of https://github.com/sveltejs/svelte
parent
67bf7a8067
commit
cf16acda32
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: enable local transitions on `svelte:element`
|
@ -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);
|
||||
btn?.click();
|
||||
flushSync();
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`<button>Toggle</button> <div style="opacity: 0;">DIV</div>`
|
||||
);
|
||||
|
||||
raf.tick(100);
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `<button>Toggle</button> <div style="">DIV</div>`);
|
||||
}
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
<script>
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
let element = $state('div');
|
||||
let show = $state(false);
|
||||
</script>
|
||||
|
||||
<button onclick={() => (show = !show)}>Toggle</button>
|
||||
|
||||
{#if show}
|
||||
<svelte:element this={element} transition:fade={{ duration: 100 }}>DIV</svelte:element>
|
||||
{/if}
|
Loading…
Reference in new issue