fix in transition when tag of <svelte:element> changed

pull/6898/head
baseballyama 5 years ago
parent 8560d7ca2b
commit 2171c67225

@ -298,6 +298,7 @@ export default class ElementWrapper extends Wrapper {
${this.var}.d(1);
${this.var} = ${this.child_dynamic_element_block.name}(#ctx);
${this.var}.c();
@transition_in(${this.var});
this.m(${this.get_update_mount_node(anchor)}, ${anchor});
} else {
${this.var}.p(#ctx, #dirty);

@ -0,0 +1,14 @@
export default {
test({ assert, component, target, raf }) {
component.visible = true;
const h1 = target.querySelector('h1');
assert.equal(h1.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both');
raf.tick(50);
component.tag = 'h2';
const h2 = target.querySelector('h2');
assert.equal(h1.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both');
assert.equal(h2.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both');
}
};

@ -0,0 +1,17 @@
<script>
export let tag = "h1";
export let visible;
function foo() {
return {
duration: 100,
css: t => {
return `opacity: ${t}`;
}
};
}
</script>
{#if visible}
<svelte:element this={tag} in:foo></svelte:element>
{/if}
Loading…
Cancel
Save