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:
17
frontend/src/lib/person/genealogy/animateView.test.ts
Normal file
17
frontend/src/lib/person/genealogy/animateView.test.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user