Skip to content

Add Fantom integration tests for core public APIs (#57466)#57466

Open
rubennorte wants to merge 1 commit into
react:mainfrom
rubennorte:export-D110784436
Open

Add Fantom integration tests for core public APIs (#57466)#57466
rubennorte wants to merge 1 commit into
react:mainfrom
rubennorte:export-D110784436

Conversation

@rubennorte

@rubennorte rubennorte commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary:

Adds Fantom -itest.js coverage for maintained, public React Native APIs that were previously untested or thinly tested, driving both the JavaScript logic and the underlying cross-platform C++ through the public react-native package surface.

To make JavaScript-driven animations deterministic under the test runner, this also introduces a small timing indirection in Animated:

  • New module Animated/AnimationTimingUtils.js exports getCurrentAnimationTime (returns Date.now() by default) and setAnimationTimeProvider (overrides the time source; pass null to restore the default).
  • TimingAnimation, SpringAnimation and DecayAnimation now read the current time from getCurrentAnimationTime() instead of calling Date.now() directly. The default behavior is unchanged.

With this, a test can override the provider with a clock that advances one frame per read, which drives the JS-driver animation at the same cadence as the native frame clock. The spring and decay tests use this to verify the actual animation curve (overshoot for an underdamped spring, exponential deceleration for decay), not just the final value, and to run a single unified code path for both the JS and native drivers.

New test files:

  • Animated/__tests__/SpringAnimation-itest.js, DecayAnimation-itest.js, AnimatedColor-itest.js, AnimatedComposition-itest.js — spring/decay curve shape (both drivers), Animated.Color value semantics, and the composition nodes (add/subtract/multiply/divide/modulo/diffClamp/tracking). AnimatedFantomTestUtils.js holds the shared trajectory helper.
  • Components/View/__tests__/View-nativeCSSParsing-itest.js — string-valued CSS (color functions, transform, gradients) parsed via native CSS parsing.
  • Pressability/__tests__/Pressability-touch-itest.js — press in/out/press, long press, press delay, and responder termination via touch events and the deterministic timer mock.
  • Interaction/__tests__/PanResponder-itest.js — grant/move/release/terminate and gesture state across touch sequences.
  • LayoutAnimation/__tests__/LayoutAnimation-itest.jsconfigureNext/create/presets applying the resulting layout.
  • Network/__tests__/Network-itest.js — synchronous XMLHttpRequest lifecycle and validation.

Extended test files:

  • Components/TextInput/__tests__/TextInput-itest.jsonSelectionChange/onSubmitEditing/onKeyPress/onEndEditing events.
  • Lists/__tests__/FlatList-itest.jsonViewableItemsChanged across all viewabilityConfig options (itemVisiblePercentThreshold, viewAreaCoveragePercentThreshold, minimumViewTime, waitForInteraction).
  • Text/__tests__/Text-itest.jsletterSpacing, lineHeight, and fontVariant styles.

The runtime behavior of Animated is unchanged; the new timing indirection defaults to Date.now().

Changelog:
[Internal]

Reviewed By: javache, zeyap

Differential Revision: D110784436

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 7, 2026
@meta-codesync

meta-codesync Bot commented Jul 7, 2026

Copy link
Copy Markdown

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D110784436.

@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Jul 7, 2026
@meta-codesync meta-codesync Bot changed the title Add Fantom integration tests for core public APIs Add Fantom integration tests for core public APIs (#57466) Jul 7, 2026
rubennorte added a commit to rubennorte/react-native that referenced this pull request Jul 7, 2026
Summary:

Adds Fantom `-itest.js` coverage for maintained, public React Native APIs that were previously untested or thinly tested, driving both the JavaScript logic and the underlying cross-platform C++ through the public `react-native` package surface.

New test files:
- `Animated/__tests__/SpringAnimation-itest.js`, `DecayAnimation-itest.js`, `AnimatedColor-itest.js`, `AnimatedComposition-itest.js` — spring/decay animations (JS and native driver), `Animated.Color` value semantics, and the composition nodes (`add`/`subtract`/`multiply`/`divide`/`modulo`/`diffClamp`/tracking).
- `Components/View/__tests__/View-nativeCSSParsing-itest.js` — string-valued CSS (color functions, transform, gradients) parsed via native CSS parsing.
- `Pressability/__tests__/Pressability-touch-itest.js` — press in/out/press, long press, press delay, and responder termination via touch events and the deterministic timer mock.
- `Interaction/__tests__/PanResponder-itest.js` — grant/move/release/terminate and gesture state across touch sequences.
- `LayoutAnimation/__tests__/LayoutAnimation-itest.js` — `configureNext`/`create`/presets applying the resulting layout.
- `Network/__tests__/Network-itest.js` — synchronous `XMLHttpRequest` lifecycle and validation.

Extended test files:
- `Components/TextInput/__tests__/TextInput-itest.js` — `onSelectionChange`/`onSubmitEditing`/`onKeyPress`/`onEndEditing` events.
- `Lists/__tests__/FlatList-itest.js` — `onViewableItemsChanged` via `viewabilityConfig` and `viewabilityConfigCallbackPairs`.
- `Text/__tests__/Text-itest.js` — `letterSpacing`, `lineHeight`, and `fontVariant` styles.

The JS-driver decay test asserts that the animation completes (which exercises `onUpdate`) rather than asserting per-frame movement, since the `requestAnimationFrame`-based decay does not expose stable intermediate frame values under the test runner's virtual clock.

This is a test-only change with no runtime or user-facing impact.

Changelog:
[Internal]

Differential Revision: D110784436
@rubennorte rubennorte force-pushed the export-D110784436 branch from 4e44ec3 to b4a4ac8 Compare July 7, 2026 18:28
rubennorte added a commit to rubennorte/react-native that referenced this pull request Jul 14, 2026
Summary:

Adds Fantom `-itest.js` coverage for maintained, public React Native APIs that were previously untested or thinly tested, driving both the JavaScript logic and the underlying cross-platform C++ through the public `react-native` package surface.

To make JavaScript-driven animations deterministic under the test runner, this also introduces a small timing indirection in `Animated`:

- New module `Animated/AnimationTimingUtils.js` exports `getCurrentAnimationTime` (returns `Date.now()` by default) and `setAnimationTimeProvider` (overrides the time source; pass `null` to restore the default).
- `TimingAnimation`, `SpringAnimation` and `DecayAnimation` now read the current time from `getCurrentAnimationTime()` instead of calling `Date.now()` directly. The default behavior is unchanged.

With this, a test can override the provider with a clock that advances one frame per read, which drives the JS-driver animation at the same cadence as the native frame clock. The spring and decay tests use this to verify the actual animation curve (overshoot for an underdamped spring, exponential deceleration for decay), not just the final value, and to run a single unified code path for both the JS and native drivers.

New test files:
- `Animated/__tests__/SpringAnimation-itest.js`, `DecayAnimation-itest.js`, `AnimatedColor-itest.js`, `AnimatedComposition-itest.js` — spring/decay curve shape (both drivers), `Animated.Color` value semantics, and the composition nodes (`add`/`subtract`/`multiply`/`divide`/`modulo`/`diffClamp`/tracking). `AnimatedFantomTestUtils.js` holds the shared trajectory helper.
- `Components/View/__tests__/View-nativeCSSParsing-itest.js` — string-valued CSS (color functions, transform, gradients) parsed via native CSS parsing.
- `Pressability/__tests__/Pressability-touch-itest.js` — press in/out/press, long press, press delay, and responder termination via touch events and the deterministic timer mock.
- `Interaction/__tests__/PanResponder-itest.js` — grant/move/release/terminate and gesture state across touch sequences.
- `LayoutAnimation/__tests__/LayoutAnimation-itest.js` — `configureNext`/`create`/presets applying the resulting layout.
- `Network/__tests__/Network-itest.js` — synchronous `XMLHttpRequest` lifecycle and validation.

Extended test files:
- `Components/TextInput/__tests__/TextInput-itest.js` — `onSelectionChange`/`onSubmitEditing`/`onKeyPress`/`onEndEditing` events.
- `Lists/__tests__/FlatList-itest.js` — `onViewableItemsChanged` across all `viewabilityConfig` options (`itemVisiblePercentThreshold`, `viewAreaCoveragePercentThreshold`, `minimumViewTime`, `waitForInteraction`).
- `Text/__tests__/Text-itest.js` — `letterSpacing`, `lineHeight`, and `fontVariant` styles.

The runtime behavior of `Animated` is unchanged; the new timing indirection defaults to `Date.now()`.

Changelog:
[Internal]

Differential Revision: D110784436
rubennorte added a commit to rubennorte/react-native that referenced this pull request Jul 14, 2026
Summary:

Adds Fantom `-itest.js` coverage for maintained, public React Native APIs that were previously untested or thinly tested, driving both the JavaScript logic and the underlying cross-platform C++ through the public `react-native` package surface.

To make JavaScript-driven animations deterministic under the test runner, this also introduces a small timing indirection in `Animated`:

- New module `Animated/AnimationTimingUtils.js` exports `getCurrentAnimationTime` (returns `Date.now()` by default) and `setAnimationTimeProvider` (overrides the time source; pass `null` to restore the default).
- `TimingAnimation`, `SpringAnimation` and `DecayAnimation` now read the current time from `getCurrentAnimationTime()` instead of calling `Date.now()` directly. The default behavior is unchanged.

With this, a test can override the provider with a clock that advances one frame per read, which drives the JS-driver animation at the same cadence as the native frame clock. The spring and decay tests use this to verify the actual animation curve (overshoot for an underdamped spring, exponential deceleration for decay), not just the final value, and to run a single unified code path for both the JS and native drivers.

New test files:
- `Animated/__tests__/SpringAnimation-itest.js`, `DecayAnimation-itest.js`, `AnimatedColor-itest.js`, `AnimatedComposition-itest.js` — spring/decay curve shape (both drivers), `Animated.Color` value semantics, and the composition nodes (`add`/`subtract`/`multiply`/`divide`/`modulo`/`diffClamp`/tracking). `AnimatedFantomTestUtils.js` holds the shared trajectory helper.
- `Components/View/__tests__/View-nativeCSSParsing-itest.js` — string-valued CSS (color functions, transform, gradients) parsed via native CSS parsing.
- `Pressability/__tests__/Pressability-touch-itest.js` — press in/out/press, long press, press delay, and responder termination via touch events and the deterministic timer mock.
- `Interaction/__tests__/PanResponder-itest.js` — grant/move/release/terminate and gesture state across touch sequences.
- `LayoutAnimation/__tests__/LayoutAnimation-itest.js` — `configureNext`/`create`/presets applying the resulting layout.
- `Network/__tests__/Network-itest.js` — synchronous `XMLHttpRequest` lifecycle and validation.

Extended test files:
- `Components/TextInput/__tests__/TextInput-itest.js` — `onSelectionChange`/`onSubmitEditing`/`onKeyPress`/`onEndEditing` events.
- `Lists/__tests__/FlatList-itest.js` — `onViewableItemsChanged` across all `viewabilityConfig` options (`itemVisiblePercentThreshold`, `viewAreaCoveragePercentThreshold`, `minimumViewTime`, `waitForInteraction`).
- `Text/__tests__/Text-itest.js` — `letterSpacing`, `lineHeight`, and `fontVariant` styles.

The runtime behavior of `Animated` is unchanged; the new timing indirection defaults to `Date.now()`.

Changelog:
[Internal]

Differential Revision: D110784436
rubennorte added a commit to rubennorte/react-native that referenced this pull request Jul 14, 2026
Summary:

Adds Fantom `-itest.js` coverage for maintained, public React Native APIs that were previously untested or thinly tested, driving both the JavaScript logic and the underlying cross-platform C++ through the public `react-native` package surface.

To make JavaScript-driven animations deterministic under the test runner, this also introduces a small timing indirection in `Animated`:

- New module `Animated/AnimationTimingUtils.js` exports `getCurrentAnimationTime` (returns `Date.now()` by default) and `setAnimationTimeProvider` (overrides the time source; pass `null` to restore the default).
- `TimingAnimation`, `SpringAnimation` and `DecayAnimation` now read the current time from `getCurrentAnimationTime()` instead of calling `Date.now()` directly. The default behavior is unchanged.

With this, a test can override the provider with a clock that advances one frame per read, which drives the JS-driver animation at the same cadence as the native frame clock. The spring and decay tests use this to verify the actual animation curve (overshoot for an underdamped spring, exponential deceleration for decay), not just the final value, and to run a single unified code path for both the JS and native drivers.

New test files:
- `Animated/__tests__/SpringAnimation-itest.js`, `DecayAnimation-itest.js`, `AnimatedColor-itest.js`, `AnimatedComposition-itest.js` — spring/decay curve shape (both drivers), `Animated.Color` value semantics, and the composition nodes (`add`/`subtract`/`multiply`/`divide`/`modulo`/`diffClamp`/tracking). `AnimatedFantomTestUtils.js` holds the shared trajectory helper.
- `Components/View/__tests__/View-nativeCSSParsing-itest.js` — string-valued CSS (color functions, transform, gradients) parsed via native CSS parsing.
- `Pressability/__tests__/Pressability-touch-itest.js` — press in/out/press, long press, press delay, and responder termination via touch events and the deterministic timer mock.
- `Interaction/__tests__/PanResponder-itest.js` — grant/move/release/terminate and gesture state across touch sequences.
- `LayoutAnimation/__tests__/LayoutAnimation-itest.js` — `configureNext`/`create`/presets applying the resulting layout.
- `Network/__tests__/Network-itest.js` — synchronous `XMLHttpRequest` lifecycle and validation.

Extended test files:
- `Components/TextInput/__tests__/TextInput-itest.js` — `onSelectionChange`/`onSubmitEditing`/`onKeyPress`/`onEndEditing` events.
- `Lists/__tests__/FlatList-itest.js` — `onViewableItemsChanged` across all `viewabilityConfig` options (`itemVisiblePercentThreshold`, `viewAreaCoveragePercentThreshold`, `minimumViewTime`, `waitForInteraction`).
- `Text/__tests__/Text-itest.js` — `letterSpacing`, `lineHeight`, and `fontVariant` styles.

The runtime behavior of `Animated` is unchanged; the new timing indirection defaults to `Date.now()`.

Changelog:
[Internal]

Reviewed By: javache, zeyap

Differential Revision: D110784436
Summary:

Adds Fantom `-itest.js` coverage for maintained, public React Native APIs that were previously untested or thinly tested, driving both the JavaScript logic and the underlying cross-platform C++ through the public `react-native` package surface.

To make JavaScript-driven animations deterministic under the test runner, this also introduces a small timing indirection in `Animated`:

- New module `Animated/AnimationTimingUtils.js` exports `getCurrentAnimationTime` (returns `Date.now()` by default) and `setAnimationTimeProvider` (overrides the time source; pass `null` to restore the default).
- `TimingAnimation`, `SpringAnimation` and `DecayAnimation` now read the current time from `getCurrentAnimationTime()` instead of calling `Date.now()` directly. The default behavior is unchanged.

With this, a test can override the provider with a clock that advances one frame per read, which drives the JS-driver animation at the same cadence as the native frame clock. The spring and decay tests use this to verify the actual animation curve (overshoot for an underdamped spring, exponential deceleration for decay), not just the final value, and to run a single unified code path for both the JS and native drivers.

New test files:
- `Animated/__tests__/SpringAnimation-itest.js`, `DecayAnimation-itest.js`, `AnimatedColor-itest.js`, `AnimatedComposition-itest.js` — spring/decay curve shape (both drivers), `Animated.Color` value semantics, and the composition nodes (`add`/`subtract`/`multiply`/`divide`/`modulo`/`diffClamp`/tracking). `AnimatedFantomTestUtils.js` holds the shared trajectory helper.
- `Components/View/__tests__/View-nativeCSSParsing-itest.js` — string-valued CSS (color functions, transform, gradients) parsed via native CSS parsing.
- `Pressability/__tests__/Pressability-touch-itest.js` — press in/out/press, long press, press delay, and responder termination via touch events and the deterministic timer mock.
- `Interaction/__tests__/PanResponder-itest.js` — grant/move/release/terminate and gesture state across touch sequences.
- `LayoutAnimation/__tests__/LayoutAnimation-itest.js` — `configureNext`/`create`/presets applying the resulting layout.
- `Network/__tests__/Network-itest.js` — synchronous `XMLHttpRequest` lifecycle and validation.

Extended test files:
- `Components/TextInput/__tests__/TextInput-itest.js` — `onSelectionChange`/`onSubmitEditing`/`onKeyPress`/`onEndEditing` events.
- `Lists/__tests__/FlatList-itest.js` — `onViewableItemsChanged` across all `viewabilityConfig` options (`itemVisiblePercentThreshold`, `viewAreaCoveragePercentThreshold`, `minimumViewTime`, `waitForInteraction`).
- `Text/__tests__/Text-itest.js` — `letterSpacing`, `lineHeight`, and `fontVariant` styles.

The runtime behavior of `Animated` is unchanged; the new timing indirection defaults to `Date.now()`.

Changelog:
[Internal]

Reviewed By: javache, zeyap

Differential Revision: D110784436
rubennorte added a commit to rubennorte/react-native that referenced this pull request Jul 14, 2026
Summary:

Adds Fantom `-itest.js` coverage for maintained, public React Native APIs that were previously untested or thinly tested, driving both the JavaScript logic and the underlying cross-platform C++ through the public `react-native` package surface.

To make JavaScript-driven animations deterministic under the test runner, this also introduces a small timing indirection in `Animated`:

- New module `Animated/AnimationTimingUtils.js` exports `getCurrentAnimationTime` (returns `Date.now()` by default) and `setAnimationTimeProvider` (overrides the time source; pass `null` to restore the default).
- `TimingAnimation`, `SpringAnimation` and `DecayAnimation` now read the current time from `getCurrentAnimationTime()` instead of calling `Date.now()` directly. The default behavior is unchanged.

With this, a test can override the provider with a clock that advances one frame per read, which drives the JS-driver animation at the same cadence as the native frame clock. The spring and decay tests use this to verify the actual animation curve (overshoot for an underdamped spring, exponential deceleration for decay), not just the final value, and to run a single unified code path for both the JS and native drivers.

New test files:
- `Animated/__tests__/SpringAnimation-itest.js`, `DecayAnimation-itest.js`, `AnimatedColor-itest.js`, `AnimatedComposition-itest.js` — spring/decay curve shape (both drivers), `Animated.Color` value semantics, and the composition nodes (`add`/`subtract`/`multiply`/`divide`/`modulo`/`diffClamp`/tracking). `AnimatedFantomTestUtils.js` holds the shared trajectory helper.
- `Components/View/__tests__/View-nativeCSSParsing-itest.js` — string-valued CSS (color functions, transform, gradients) parsed via native CSS parsing.
- `Pressability/__tests__/Pressability-touch-itest.js` — press in/out/press, long press, press delay, and responder termination via touch events and the deterministic timer mock.
- `Interaction/__tests__/PanResponder-itest.js` — grant/move/release/terminate and gesture state across touch sequences.
- `LayoutAnimation/__tests__/LayoutAnimation-itest.js` — `configureNext`/`create`/presets applying the resulting layout.
- `Network/__tests__/Network-itest.js` — synchronous `XMLHttpRequest` lifecycle and validation.

Extended test files:
- `Components/TextInput/__tests__/TextInput-itest.js` — `onSelectionChange`/`onSubmitEditing`/`onKeyPress`/`onEndEditing` events.
- `Lists/__tests__/FlatList-itest.js` — `onViewableItemsChanged` across all `viewabilityConfig` options (`itemVisiblePercentThreshold`, `viewAreaCoveragePercentThreshold`, `minimumViewTime`, `waitForInteraction`).
- `Text/__tests__/Text-itest.js` — `letterSpacing`, `lineHeight`, and `fontVariant` styles.

The runtime behavior of `Animated` is unchanged; the new timing indirection defaults to `Date.now()`.

Changelog:
[Internal]

Reviewed By: javache, zeyap

Differential Revision: D110784436
rubennorte added a commit to rubennorte/react-native that referenced this pull request Jul 14, 2026
Summary:
Pull Request resolved: react#57466

Adds Fantom `-itest.js` coverage for maintained, public React Native APIs that were previously untested or thinly tested, driving both the JavaScript logic and the underlying cross-platform C++ through the public `react-native` package surface.

To make JavaScript-driven animations deterministic under the test runner, this also introduces a small timing indirection in `Animated`:

- New module `Animated/AnimationTimingUtils.js` exports `getCurrentAnimationTime` (returns `Date.now()` by default) and `setAnimationTimeProvider` (overrides the time source; pass `null` to restore the default).
- `TimingAnimation`, `SpringAnimation` and `DecayAnimation` now read the current time from `getCurrentAnimationTime()` instead of calling `Date.now()` directly. The default behavior is unchanged.

With this, a test can override the provider with a clock that advances one frame per read, which drives the JS-driver animation at the same cadence as the native frame clock. The spring and decay tests use this to verify the actual animation curve (overshoot for an underdamped spring, exponential deceleration for decay), not just the final value, and to run a single unified code path for both the JS and native drivers.

New test files:
- `Animated/__tests__/SpringAnimation-itest.js`, `DecayAnimation-itest.js`, `AnimatedColor-itest.js`, `AnimatedComposition-itest.js` — spring/decay curve shape (both drivers), `Animated.Color` value semantics, and the composition nodes (`add`/`subtract`/`multiply`/`divide`/`modulo`/`diffClamp`/tracking). `AnimatedFantomTestUtils.js` holds the shared trajectory helper.
- `Components/View/__tests__/View-nativeCSSParsing-itest.js` — string-valued CSS (color functions, transform, gradients) parsed via native CSS parsing.
- `Pressability/__tests__/Pressability-touch-itest.js` — press in/out/press, long press, press delay, and responder termination via touch events and the deterministic timer mock.
- `Interaction/__tests__/PanResponder-itest.js` — grant/move/release/terminate and gesture state across touch sequences.
- `LayoutAnimation/__tests__/LayoutAnimation-itest.js` — `configureNext`/`create`/presets applying the resulting layout.
- `Network/__tests__/Network-itest.js` — synchronous `XMLHttpRequest` lifecycle and validation.

Extended test files:
- `Components/TextInput/__tests__/TextInput-itest.js` — `onSelectionChange`/`onSubmitEditing`/`onKeyPress`/`onEndEditing` events.
- `Lists/__tests__/FlatList-itest.js` — `onViewableItemsChanged` across all `viewabilityConfig` options (`itemVisiblePercentThreshold`, `viewAreaCoveragePercentThreshold`, `minimumViewTime`, `waitForInteraction`).
- `Text/__tests__/Text-itest.js` — `letterSpacing`, `lineHeight`, and `fontVariant` styles.

The runtime behavior of `Animated` is unchanged; the new timing indirection defaults to `Date.now()`.

Changelog:
[Internal]

Differential Revision: D110784436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant