mirror of https://github.com/sveltejs/svelte
parent
8560d7ca2b
commit
2171c67225
@ -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…
Reference in new issue