mirror of https://github.com/sveltejs/svelte
parent
3057d9eecd
commit
1203b9e2e8
@ -1 +0,0 @@
|
|||||||
A
|
|
@ -1,10 +0,0 @@
|
|||||||
export default {
|
|
||||||
async test({ assert, target, window, raf }) {
|
|
||||||
const button = target.querySelector("button");
|
|
||||||
const event = new window.MouseEvent("click");
|
|
||||||
assert.htmlEqual(target.innerHTML, "A");
|
|
||||||
await button.dispatchEvent(event);
|
|
||||||
raf.tick(500);
|
|
||||||
assert.htmlEqual(target.innerHTML, "A");
|
|
||||||
},
|
|
||||||
};
|
|
@ -1,36 +0,0 @@
|
|||||||
<script>
|
|
||||||
import Component from "./Component.svelte";
|
|
||||||
function foo(node, params) {
|
|
||||||
return {
|
|
||||||
duration: 100,
|
|
||||||
tick: t => {
|
|
||||||
node.foo = t;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
let isFirst = true;
|
|
||||||
let animationActive = false;
|
|
||||||
|
|
||||||
const toggle = () => {
|
|
||||||
if (animationActive) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
animationActive = true;
|
|
||||||
Promise.resolve().then(() => {
|
|
||||||
isFirst = !isFirst;
|
|
||||||
animationActive = false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<button on:click={toggle}>TOGGLE</button>
|
|
||||||
{#if !animationActive}
|
|
||||||
<div out:foo>
|
|
||||||
{#if isFirst}
|
|
||||||
<Component {isFirst} />
|
|
||||||
{:else}
|
|
||||||
<Component {isFirst} />
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
Loading…
Reference in new issue