api docs + test

pull/4272/head
mtrelis 6 years ago
parent 029030cd27
commit d643ac7849

@ -979,6 +979,8 @@ Similar to `transition:`, but only applies to elements entering (`in:`) or leavi
Unlike with `transition:`, transitions applied with `in:` and `out:` are not bidirectional — an in transition will continue to 'play' alongside the out transition, rather than reversing, if the block is outroed while the transition is in progress. If an out transition is aborted, transitions will restart from scratch.
If an `out:` custom transition function returns a promise instead of a transition object, svelte will simply await its completion before unmounting the node.
```html
{#if visible}
<div in:fly out:fade>

@ -0,0 +1,14 @@
export default {
props: {
visible: true,
},
test({ assert, component, target }) {
component.visible = false;
assert.notEqual(target.querySelector('span'), undefined);
component.resolve();
setTimeout(() => {
assert.equal(target.querySelector('span'), undefined);
});
},
};

@ -0,0 +1,14 @@
<script>
export let visible;
export let resolve
function foo(node, params) {
return new Promise(r => {
resolve = r
});
}
</script>
{#if visible}
<span out:foo>hello</span>
{/if}
Loading…
Cancel
Save