()
| 251 | } |
| 252 | |
| 253 | function describeFromProp() { |
| 254 | describe('when "from" prop is defined', () => { |
| 255 | it('controls the start value', async () => { |
| 256 | const spring = new SpringValue<number>() |
| 257 | const onChange = vi.fn() |
| 258 | spring.start({ |
| 259 | from: 5, |
| 260 | to: 10, |
| 261 | config: { duration: 10 * frameLength }, |
| 262 | onChange, |
| 263 | }) |
| 264 | expect(spring.get()).toBe(5) |
| 265 | await global.advance() |
| 266 | // After the first frame the spring should have moved away from "from" |
| 267 | // toward "to" — it should never have read its prior current value. |
| 268 | // `onChange` receives an AnimationResult, so read `result.value`. See #2183. |
| 269 | expect(onChange.mock.calls[0][0].value).toBeGreaterThan(5) |
| 270 | await global.advanceUntilIdle() |
| 271 | expect(spring.get()).toBe(10) |
| 272 | }) |
| 273 | }) |
| 274 | } |
| 275 | |
| 276 | function describeResetProp() { |
| 277 | describe('when "reset" prop is true', () => { |
no test coverage detected
searching dependent graphs…