import { describe, expect, it, vi } from 'vitest'; import { FADE_SCALE, FADE_UP, STAGGER_FAST, getMotionContainerProps, getMotionItemProps, prefersReducedMotion } from '../motion'; describe('motion helpers', () => { it('returns disabled props when motion is off', () => { const props = getMotionContainerProps(false, STAGGER_FAST); expect(props.initial).toBe(false); }); it('returns variants when motion is on', () => { const containerProps = getMotionContainerProps(true, STAGGER_FAST); const itemProps = getMotionItemProps(true, FADE_UP); expect(containerProps.initial).toBe('hidden'); expect(containerProps.animate).toBe('show'); expect(itemProps.variants).toBe(FADE_UP); }); it('detects reduced motion preference safely', () => { const original = window.matchMedia; Object.defineProperty(window, 'matchMedia', { configurable: true, value: undefined, }); expect(prefersReducedMotion()).toBe(false); Object.defineProperty(window, 'matchMedia', { configurable: true, value: vi.fn().mockReturnValue({ matches: true }), }); expect(prefersReducedMotion()).toBe(true); Object.defineProperty(window, 'matchMedia', { configurable: true, value: original, }); }); it('exposes distinct base variants', () => { expect(FADE_UP).not.toBe(FADE_SCALE); }); });