Production-ready animations, transitions, backgrounds, and scenes for Remotion
accordion — verification tests
Pure / deterministic verification for the accordion component
(registry/remocn-ui/accordion/). The RENDER path needs useRemocnTheme()
and the Remotion render tree and cannot run headless, so the render is NOT
exercised here. This suite covers the pieces that ARE pure: AccordionState
union membership, accordionConfig.controls wiring, accordionConfig.snippet
codegen, accordionStyle presets, tweenAccordionStyle interpolation, and
DEFAULT_DURATION.
Animation model — pure snap + opt-in smooth path
Accordion ships two complementary paths:
Snap path (state?: AccordionState prop):
Accordion is a frame-free pure renderer. The state prop drives all visuals.
Each state maps to a complete resting visual via the exported pure function
accordionStyle(state, ctx) => AccordionStyle. State changes snap instantly —
no tweening inside the component.
Smooth path (style?: AccordionStyle prop):
Callers opt in to smooth transitions by passing a pre-interpolated
AccordionStyle to the style prop. The caller — typically
useAccordionTransition — reads useCurrentFrame() and calls
useStateTransition from core/timeline.ts to compute
{ from, to, progress }, then blends the two presets via
tweenAccordionStyle(from, to, t). The Accordion component itself remains
frame-free; it simply renders whatever AccordionStyle it receives.
This design keeps Accordion pure-testable (no Remotion render context needed)
while still supporting smooth open/close transitions for production use.
How to run
The repo uses Bun, which has a built-in test runner — runs TypeScript natively, no test-framework dep.
bun install
bun test registry/remocn-ui/accordion/__tests__
accordion.test.ts imports bun:test (not vitest/jest), so no test script
or framework dep is added to package.json.
What is covered
AccordionStateunion — asserts the two states["opened", "closed"]are the complete set (via the realcontrols.state.optionslist fromconfig.ts).accordionConfig.controls.state— the customizer control wiring. Asserts aselectcontrol exists with exactly those two options in order, default"opened"(so the preview showcases the revealed panel), and that every option is a member of theAccordionStateunion.accordionConfig.controls.variant— asserts aselectcontrol with options["default", "ghost"], default"default".accordionConfig.snippet— REAL pure string builder (high value). Asserts: always emitsstate="<state>"for every option; NEVER emitsstepsoraction; includesimport { Accordion }from@/components/remocn/accordion; omits default-equal props (title="Is it accessible?",content="Yes. It adheres to the WAI-ARIA design pattern.",variant="default",mode="light"); EMITS non-defaulttitle/content/variant/mode; structural round-trip (starts with import, contains<Accordion, ends/>).accordionStylepresets — exported pure(state, ctx) => AccordionStylemap. AnAccordionStyleContextis built fromaccordionStyleContext("default", defaultLightTheme)— the same call the component makes internally. Asserts per-state numeric invariants (panelHeight,panelOpacity,chevronRotation) and thatbackgroundis always a non-empty string. Also asserts the closed/opened invariant: closed has all three numeric fields at 0; opened haspanelHeight1,panelOpacity1,chevronRotation180.tweenAccordionStyle— exported pure(a, b, t) => AccordionStyle. Asserts: at t=0 all numeric fields equala; at t=1 all equalb; at t=0.5 each numeric field is the exact midpoint (e.g.panelHeight0→1 gives 0.5,chevronRotation0→180 gives 90,panelOpacity0→1 gives 0.5).backgroundat all t is a non-empty string (the oklch mix value is not hardcoded). Both directions (closed→opened and opened→closed) are verified.DEFAULT_DURATION— sanity-checks the exported constant is a positive number equal to 14.
Accordion render is a pure (style | state) => visual observable only via
Remotion render, not unit-tested here.
Import strategy
accordion.test.ts imports via a mix of relative paths and the
@/lib/remocn-ui tsconfig alias:
../index— relative, forAccordionState,accordionStyle,accordionStyleContext../use-accordion-transition— relative, fortweenAccordionStyle,DEFAULT_DURATION../config— relative, foraccordionConfig@/lib/remocn-ui— alias (resolves toregistry/remocn-ui/core/index.ts), fordefaultLightTheme
Importing index.tsx and use-accordion-transition.ts pulls the remotion
module (and React), but neither accordionStyle, accordionStyleContext, nor
tweenAccordionStyle call useCurrentFrame() at import time or at call time —
they are pure value functions. bun test resolves tsconfig paths, so the
alias works without additional config.
Determinism grep checklist (run manually; must print NOTHING)
Accordion is a state atom and must be frame-free. The component's index.tsx
must contain none of the following:
grep -nE "useCurrentFrame|useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
registry/remocn-ui/accordion/index.tsx
Expected: no output. Any match is a determinism violation.
use-accordion-transition.ts is the CALLER hook that intentionally reads
useCurrentFrame() (via useStateTransition). It is not a render component;
the smooth-path design isolates all frame-reading to the hook, keeping
Accordion pure.
Tier-wide sweep:
grep -nE "useState|useEffect|onClick|onChange|addEventListener|Date\.now|Math\.random" \
registry/remocn-ui/accordion/index.tsx registry/remocn-ui/core/*.ts