mirror of https://github.com/sveltejs/svelte
fix : $.component() break transition (#13646)
* $.component() must use EFFECT_TRANSPARENT * changeset * Update .changeset/eight-pans-worry.md --------- Co-authored-by: Dominic Gannaway <trueadm@users.noreply.github.com>pull/13648/head
parent
139114bdcb
commit
bb245445fc
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: transitions within dynamic components now function correctly
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
function fade(_) {
|
||||
return {
|
||||
duration: 100,
|
||||
css: (t) => `opacity: ${t}`
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<p transition:fade>foo</p>
|
||||
|
@ -0,0 +1,32 @@
|
||||
import { flushSync } from '../../../../src/index-client.js';
|
||||
import { test } from '../../test';
|
||||
|
||||
/**
|
||||
* $.component() should not break transition
|
||||
* https://github.com/sveltejs/svelte/issues/13645
|
||||
*/
|
||||
export default test({
|
||||
test({ assert, raf, target }) {
|
||||
const btn = target.querySelector('button');
|
||||
|
||||
// in
|
||||
btn?.click();
|
||||
flushSync();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
'<button>toggle</button><p style="opacity: 0;">foo</p><p style="opacity: 0;">foo</p>'
|
||||
);
|
||||
|
||||
raf.tick(50);
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
'<button>toggle</button><p style="opacity: 0.5;">foo</p><p style="opacity: 0.5;">foo</p>'
|
||||
);
|
||||
|
||||
raf.tick(100);
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
'<button>toggle</button><p style="">foo</p><p style="">foo</p>'
|
||||
);
|
||||
}
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
<script>
|
||||
import Foo from './Foo.svelte';
|
||||
const Comp = { Foo };
|
||||
|
||||
let visible = $state(false);
|
||||
</script>
|
||||
|
||||
<button onclick={() => (visible = !visible)}>toggle</button>
|
||||
|
||||
{#if visible}
|
||||
<Foo />
|
||||
<Comp.Foo />
|
||||
{/if}
|
Loading…
Reference in new issue