mirror of https://github.com/sveltejs/svelte
abort transition on detach - alternative fix for #1561
parent
bec49a0ad0
commit
f3e4f04a54
@ -0,0 +1,19 @@
|
||||
export default {
|
||||
skipIntroByDefault: true,
|
||||
|
||||
data: {
|
||||
visible: true
|
||||
},
|
||||
|
||||
test(assert, component, target, window, raf) {
|
||||
component.set({ visible: false });
|
||||
const div = target.querySelector('div');
|
||||
|
||||
raf.tick(50);
|
||||
assert.equal(div.foo, 0.5);
|
||||
|
||||
component.destroy();
|
||||
|
||||
raf.tick(100);
|
||||
},
|
||||
};
|
@ -0,0 +1,18 @@
|
||||
{#if visible}
|
||||
<div transition:foo>destroy me</div>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
transitions: {
|
||||
foo(node, params) {
|
||||
return {
|
||||
duration: 100,
|
||||
tick: t => {
|
||||
node.foo = t;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue