Description
Hello everyone,
I currently have an app which plays some animation before being initialized
, which in this case is a simple boolean. Depending on this variable, I render different content.
So if I have something like this:
<script>
import { blur } from 'svelte/transition';
import { bounceOut } from 'svelte/easing';
export let initialized = false;
</script>
<div in:blur={{ duration: 1500, easing: bounceOut }} on:introend={() => { initialized = true}}>
{#if initialized}
<p>Hello</p>
{:else}
<p>One moment...</p>
{/if}
</div>
and my test looks like this:
it('doesnt work', async () => {
render(Hello, { intro: true });
expect(screen.getByText('One moment...')).toBeDefined();
await fireEvent.animationEnd(screen.getByTestId('hello'));
await waitFor(() => expect(screen.getByText('Hello')).toBeDefined(), {
timeout: 2500,
});
});
The waitFor
never succeeds. I even tried forcing an animation end with fireEvent.animationEnd
. Here is a minimal reproduction of this issue: https://stackblitz.com/edit/vitest-dev-vitest-whwfuk?file=test/hello.test.ts
Hope somebody can help and provide a solution for this :) Thanks in advance!