-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed as not planned
Description
Describe the bug
When using the transition
with the global
modifier testing of the component fails. The same tests passes OK when global
is not used.
Reproduction
Assuming you have:
<script>
// Component.svelte
import { fade } from "svelte/transition";
</script>
<div transition:fade|global>Hello</div>
When running a test:
import { expect, test } from 'vitest';
import Component from './Component.svelte';
test('Component', async () => {
const comp = mount(Component, { target: document.body });
flushSync();
expect(document.body.innerHTML).toBe('<div>Hello</div>');
unmount(comp);
})
Got an error:
❯ src/demo.spec.js (1 test | 1 failed) 72ms
× Component 69ms
→ element.animate is not a function
in <unknown>
in Component.svelte
However if global
is removed from the transition <div transition:fade>Hello</div>
the test passes smoothly.
Logs
System Info
System:
OS: Linux 6.15 Arch Linux
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-11390H @ 3.40GHz
Memory: 25.80 GB / 31.08 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 24.2.0 - /usr/bin/node
Yarn: 1.22.22 - /usr/bin/yarn
npm: 11.4.2 - /usr/bin/npm
pnpm: 10.12.4 - /usr/bin/pnpm
Browsers:
Chromium: 138.0.7204.49
npmPackages:
svelte: ^5.0.0 => 5.34.8
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels