How to test AnimeJS Delay using Jest

205 Views Asked by At

I want to test the delay that returning from the add function, how can I do that?

Also, I'm doing animation on nuxt/vue framework

this.anime.timeline({ loop: false })
    .add({
        duration: 3000,
        easing: "easeOutExpo",
        opacity: [0, 1],
        scaleX: [0, 1],
        skewX: [-20, 0],
        targets: letters,
        translateX: [50, 0],
        translateY: [window.screen.height, 0],
        translateZ: 0,
        delay: (el, index) => 30 * (index + 1),
        complete: (anime) => {
            // after animation finishes, countries needs 1 second to show
            setTimeout(() => {
                this.$emit("isIntroFinished", anime.completed);
            }, 1000);
        },
    });
0

There are 0 best solutions below