test(core): write bodies for skipped and todo tests#2466
Merged
Conversation
The test sat inside 'when damping is less than 1.0' but passed damping: 1 (critical damping), so countBounces was always 0. Set damping: 0.5 to match the describe block's premise.
The numeric and string-numeric animation paths agree to ~15 significant digits but diverge by one ULP because the string path routes values through the interpolator. Compare frames with a tolerance instead of bitwise equality.
Implements the "still resolves the start promise" todo: when start({
immediate: true }) is used, the returned promise resolves with finished:
true and the final value.
Implements the "controls the start value" todo: passing a "from" prop on start sets the spring to that value before the first frame, and the first emitted frame moves toward "to".
Implements two "to" prop change todos: when start() is called with a new "to" mid-animation, the old promise resolves with finished:false, and an onStart prop captured by an earlier start() call is not invoked again when the retarget call passes no new onStart. The third todo (avoids calling the onRest prop) remains because the current implementation does call the previous onRest on retarget.
Implements the two "reset prop" todos: when start({ reset: true }) is
called mid-animation, the previous start promise resolves with finished:
false, and the previous onRest is invoked with finished: false.
Implements the "preserves its onRest prop between animations" todo: when a spring tracks a fluid target, an "onRest" handler set on the original start call fires for each subsequent settle as the target re-animates.
Implements the five Interpolation todos: covers SpringValue, nested Interpolation, and a custom non-animated FluidValue as sources, asserts that simultaneous input updates trigger a single recompute per frame, and that resetting an input updates the interpolation synchronously before the next frame.
Implements the five useTrail todos: a props function is not re-invoked when the hook re-renders with no deps change, and toggling the "reverse" prop swaps "to"/"from" on the new head and flips the parent-spring chaining direction for the followers.
Implements the remaining two "immediate" prop todos by locking in the current behaviour: an immediate animation still fires onStart and onRest on the next frame with finished: true. This matches the convention used by Framer Motion, GSAP, the Web Animations API, and React Native Animated, where a zero-duration animation completes through the normal lifecycle. spring.set() remains the lifecycle-free path.
"Prevents the animation if true" implied no lifecycle events. The immediate animation still fires onStart and onRest on its single frame; SpringValue.set() is the lifecycle-free path.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
The `private value` shorthand declared a class field that was never read — the constructor captures the local parameter via closure. TS6138 fails strict CI matrix builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Walks through every
it.skipandit.todoin core and replaces the placeholders with real test bodies. 19 of 20 todos and both skips are now passing tests.Notable
Two
it.skips recovered by fixing the test, not the code:should bouncehaddamping: 1despite being insidedescribe('when damping is less than 1.0'); the numeric/string parity test was demanding bitwise equality from paths that drift by one ULP.Locked in
immediate: truelifecycle semantics:onStartandonRestfire on the next frame withfinished: true.spring.set()is the lifecycle-free path; the docs are updated to reflect this.Deferred
One todo (
to-prop change →avoids calling the "onRest" prop) is left as.todo. The current code fires the prioronReston retarget, which contradicts the documented contract — fix in #2467.