feat(stammbaum): animate fit-to-screen, snap under reduced motion (#692)

Fit-to-screen tweens to the default view over 300ms via animateView (eased,
lerpView-driven) and snaps instantly when prefers-reduced-motion is set
(US-PAN-004 AC2, NFR-A11Y-003).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-29 16:54:34 +02:00
parent 7a6c2e877f
commit 396c87f8ab
5 changed files with 85 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
import { describe, it, expect, vi } from 'vitest';
import { animateView } from './animateView';
describe('animateView (reduced motion)', () => {
const from = { x: 0, y: 0, z: 1 };
const to = { x: 80, y: -30, z: 2 };
it('snaps straight to the target in a single frame when reduced motion is on', () => {
const onFrame = vi.fn();
const cancel = animateView(from, to, onFrame, { reducedMotion: true });
expect(onFrame).toHaveBeenCalledTimes(1);
expect(onFrame).toHaveBeenCalledWith(to);
expect(typeof cancel).toBe('function');
cancel();
});
});