From 652d50111c277b310f0a3099c539d2ee55463734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 18 Sep 2026 07:27:28 -0700 Subject: [PATCH] Use global DOM types in Fantom tests (#58569) Summary: Pull Request resolved: https://github.com/react/react-native/pull/58569 Replace Fantom test imports of internal Event, EventTarget, AbortController, and feature flag modules with supported exports and global DOM APIs. Add the missing static Event phase constants to the DOM Flow declarations so constructor constants remain typed, and route trusted-event coverage through `dispatchNativeEvent`. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D120528709 fbshipit-source-id: 9d991904dbe1f4cb061a9629026a6fc3cbc3dd16 --- packages/react-native/flow/dom.js.flow | 9 +++- .../ShadowNodeRevisionGetter-itest.js | 2 +- .../__tests__/EventTargetDispatching-itest.js | 6 ++- .../renderer/events/dispatchNativeEvent.js | 9 ++-- ...ment-Globals-IntersectionObserver-itest.js | 2 +- ...ironment-Globals-MutationObserver-itest.js | 2 +- ...nvironment-Globals-ResizeObserver-itest.js | 2 +- .../__tests__/AbortController-itest.js | 4 -- .../dom/events/__tests__/Event-itest.js | 16 +++++--- .../__tests__/EventHandlerAttributes-itest.js | 8 ++-- .../__tests__/EventTarget-benchmark-itest.js | 2 - .../dom/events/__tests__/EventTarget-itest.js | 41 ++++++++++++------- .../createEventTargetHierarchyWithDepth.js | 1 - .../__tests__/ReactNativeElement-itest.js | 2 +- .../dom/nodes/__tests__/ReadOnlyText-itest.js | 2 +- .../IntersectionObserver-benchmark-itest.js | 4 +- .../__tests__/IntersectionObserver-itest.js | 4 +- .../__tests__/structuredClone-itest.js | 3 +- .../src/__tests__/FantomFeatureFlags-itest.js | 2 +- 19 files changed, 69 insertions(+), 52 deletions(-) diff --git a/packages/react-native/flow/dom.js.flow b/packages/react-native/flow/dom.js.flow index 46b08183394..e7175d425db 100644 --- a/packages/react-native/flow/dom.js.flow +++ b/packages/react-native/flow/dom.js.flow @@ -620,7 +620,7 @@ type EventInit = Event$Init; // https://dom.spec.whatwg.org/#interface-event declare class Event { - constructor(type: string, eventInitDict?: Event$Init): void; + constructor(type: string, eventInitDict?: ?Event$Init): void; /** * Returns the type of event, e.g. "click", "hashchange", or "submit". */ @@ -713,10 +713,17 @@ declare class Event { /** Non-standard. See Event.prototype.composed */ readonly scoped: boolean; + cancelBubble: boolean; + /** * @deprecated */ initEvent(type: string, bubbles: boolean, cancelable: boolean): void; + + static readonly NONE: 0; + static readonly CAPTURING_PHASE: 1; + static readonly AT_TARGET: 2; + static readonly BUBBLING_PHASE: 3; } type CustomEvent$Init = {...Event$Init, detail?: any, ...}; diff --git a/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js b/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js index 7d2e6aa2d76..1586f63c777 100644 --- a/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js +++ b/packages/react-native/src/private/__tests__/utilities/__tests__/ShadowNodeRevisionGetter-itest.js @@ -15,7 +15,7 @@ import {createShadowNodeReferenceGetterRef} from '../ShadowNodeRevisionGetter'; import * as Fantom from '@react-native/fantom'; import * as React from 'react'; import {ScrollView, View} from 'react-native'; -import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; +import {ReactNativeFeatureFlags} from 'react-native/react-private-interface'; test('base case when cloning results in revision +1', () => { const root = Fantom.createRoot(); diff --git a/packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js b/packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js index 96ef51216ca..4c6841b60e2 100644 --- a/packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js +++ b/packages/react-native/src/private/renderer/core/__tests__/EventTargetDispatching-itest.js @@ -17,8 +17,7 @@ import type {NativePointerEvent, PointerEvent} from 'react-native'; import * as Fantom from '@react-native/fantom'; import * as React from 'react'; import {View} from 'react-native'; -import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; -import Event from 'react-native/src/private/webapis/dom/events/Event'; +import {ReactNativeFeatureFlags} from 'react-native/react-private-interface'; // Temporary cast until ReadOnlyNode extends EventTarget ungated. function asEventTarget(node: ?interface {}): EventTarget { @@ -1640,12 +1639,14 @@ describe('EventTarget-based Event Dispatching', () => { describe('direct events (rnIsDirect) — Event construction validation', () => { it('allows constructing a direct event that does not bubble', () => { const event = new Event('layout', {rnIsDirect: true}); + // $FlowFixMe[prop-missing] React Native-specific Event field. expect(event.rnIsDirect).toBe(true); expect(event.bubbles).toBe(false); }); it('defaults rnIsDirect to false', () => { const event = new Event('layout'); + // $FlowFixMe[prop-missing] React Native-specific Event field. expect(event.rnIsDirect).toBe(false); }); @@ -1752,6 +1753,7 @@ describe('EventTarget-based Event Dispatching', () => { ); expect(handler).toHaveBeenCalled(); + // $FlowFixMe[prop-missing] Flow's global Event type omits static constants. expect(observedPhase).toBe(Event.AT_TARGET); // Event path is just the target node. expect(observedPathLength).toBe(1); diff --git a/packages/react-native/src/private/renderer/events/dispatchNativeEvent.js b/packages/react-native/src/private/renderer/events/dispatchNativeEvent.js index f7333082cea..1ea15520f3d 100644 --- a/packages/react-native/src/private/renderer/events/dispatchNativeEvent.js +++ b/packages/react-native/src/private/renderer/events/dispatchNativeEvent.js @@ -8,7 +8,7 @@ * @format */ -import type EventTarget from '../../webapis/dom/events/EventTarget'; +import type InternalEventTarget from '../../webapis/dom/events/EventTarget'; import { customBubblingEventTypes, @@ -41,8 +41,11 @@ export default function dispatchNativeEvent( type: string, payload: {[string]: unknown}, ): void { + // $FlowFixMe[incompatible-type] The global is backed by this implementation. + const internalTarget = target as InternalEventTarget; + // Process responder events before normal event dispatch. - processResponderEvent(type, target, payload); + processResponderEvent(type, internalTarget, payload); try { // Normal EventTarget dispatch @@ -117,7 +120,7 @@ export default function dispatchNativeEvent( // rethrown synchronously (matching the legacy plugin path) rather than // deferred to a new task, keeping it catchable by React error boundaries // and the native event call. - dispatchTrustedEvent(target, syntheticEvent, true); + dispatchTrustedEvent(internalTarget, syntheticEvent, true); } } finally { // Rethrow the first error caught during responder lifecycle dispatch, diff --git a/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-IntersectionObserver-itest.js b/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-IntersectionObserver-itest.js index 2b8e03447d3..eaa8cb4e5b1 100644 --- a/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-IntersectionObserver-itest.js +++ b/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-IntersectionObserver-itest.js @@ -12,7 +12,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; +import {ReactNativeFeatureFlags} from 'react-native/react-private-interface'; declare var IntersectionObserverEntry: unknown; diff --git a/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-MutationObserver-itest.js b/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-MutationObserver-itest.js index 12cab7d5bf3..0ebecdced1d 100644 --- a/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-MutationObserver-itest.js +++ b/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-MutationObserver-itest.js @@ -12,7 +12,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; +import {ReactNativeFeatureFlags} from 'react-native/react-private-interface'; declare var MutationRecord: unknown; diff --git a/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-ResizeObserver-itest.js b/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-ResizeObserver-itest.js index 99cf805d12a..67bc57c0d05 100644 --- a/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-ResizeObserver-itest.js +++ b/packages/react-native/src/private/setup/__tests__/setUpDefaultReactNativeEnvironment-Globals-ResizeObserver-itest.js @@ -12,7 +12,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; +import {ReactNativeFeatureFlags} from 'react-native/react-private-interface'; declare var ResizeObserverEntry: unknown; declare var ResizeObserverSize: unknown; diff --git a/packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js b/packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js index e13929b45ee..4e8cf7dc781 100644 --- a/packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js +++ b/packages/react-native/src/private/webapis/dom/abort-api/__tests__/AbortController-itest.js @@ -13,11 +13,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import type {TimerMock} from '@react-native/fantom'; import DOMException from '../../../errors/DOMException'; -import {AbortController} from '../AbortController'; -import {AbortSignal_public as AbortSignal} from '../AbortSignal'; import * as Fantom from '@react-native/fantom'; -import Event from 'react-native/src/private/webapis/dom/events/Event'; -import EventTarget from 'react-native/src/private/webapis/dom/events/EventTarget'; let listenerCallOrder = 0; diff --git a/packages/react-native/src/private/webapis/dom/events/__tests__/Event-itest.js b/packages/react-native/src/private/webapis/dom/events/__tests__/Event-itest.js index 4c157cb38c0..7243e7f28cb 100644 --- a/packages/react-native/src/private/webapis/dom/events/__tests__/Event-itest.js +++ b/packages/react-native/src/private/webapis/dom/events/__tests__/Event-itest.js @@ -10,12 +10,15 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import Event from 'react-native/src/private/webapis/dom/events/Event'; import { setEventInitTimeStamp, setInPassiveListenerFlag, } from 'react-native/src/private/webapis/dom/events/internals/EventInternals'; +type EventOptions = EventInit & { + rnIsDirect?: boolean, +}; + describe('Event', () => { it('provides read-only constants for event phases', () => { 'use strict'; @@ -109,6 +112,7 @@ describe('Event', () => { ); expect(() => { + // $FlowFixMe[incompatible-type] The React Native implementation accepts null. return new Event('custom', null); }).not.toThrow(); @@ -121,13 +125,12 @@ describe('Event', () => { }).not.toThrow(); expect(() => { - // $FlowExpectedError[incompatible-exact] - // $FlowExpectedError[prop-missing] + // $FlowExpectedError[incompatible-type] return new Event('custom', class {}); }).not.toThrow(); expect(() => { - // $FlowExpectedError[incompatible-exact] + // $FlowExpectedError[incompatible-type] return new Event('custom', () => {}); }).not.toThrow(); }); @@ -238,7 +241,7 @@ describe('Event', () => { it('should use a custom timestamp when set via setEventInitTimeStamp', () => { const customTimestamp = 12345.678; - const options = {}; + const options: EventOptions = {}; setEventInitTimeStamp(options, customTimestamp); const event = new Event('custom', options); @@ -246,7 +249,7 @@ describe('Event', () => { }); it('should accept zero as a valid custom timestamp', () => { - const options = {}; + const options: EventOptions = {}; setEventInitTimeStamp(options, 0); const event = new Event('custom', options); @@ -300,6 +303,7 @@ describe('Event', () => { expect(event.defaultPrevented).toBe(false); + // $FlowFixMe[incompatible-type] The global is backed by this implementation. setInPassiveListenerFlag(event, true); event.preventDefault(); diff --git a/packages/react-native/src/private/webapis/dom/events/__tests__/EventHandlerAttributes-itest.js b/packages/react-native/src/private/webapis/dom/events/__tests__/EventHandlerAttributes-itest.js index ea5626b40f0..a13fe1c3558 100644 --- a/packages/react-native/src/private/webapis/dom/events/__tests__/EventHandlerAttributes-itest.js +++ b/packages/react-native/src/private/webapis/dom/events/__tests__/EventHandlerAttributes-itest.js @@ -12,21 +12,21 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import type {EventCallback} from 'react-native/src/private/webapis/dom/events/EventTarget'; - -import Event from 'react-native/src/private/webapis/dom/events/Event'; import { getEventHandlerAttribute, setEventHandlerAttribute, } from 'react-native/src/private/webapis/dom/events/EventHandlerAttributes'; -import EventTarget from 'react-native/src/private/webapis/dom/events/EventTarget'; + +type EventCallback = (event: Event) => void; class EventTargetSubclass extends EventTarget { get oncustomevent(): EventCallback | null { + // $FlowFixMe[incompatible-type] The globals are backed by these implementations. return getEventHandlerAttribute(this, 'customEvent'); } set oncustomevent(listener: ?EventCallback) { + // $FlowFixMe[incompatible-type] The globals are backed by these implementations. setEventHandlerAttribute(this, 'customEvent', listener); } } diff --git a/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-benchmark-itest.js b/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-benchmark-itest.js index 59c2e9d3317..2f47815b65a 100644 --- a/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-benchmark-itest.js +++ b/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-benchmark-itest.js @@ -13,8 +13,6 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import createEventTargetHierarchyWithDepth from './createEventTargetHierarchyWithDepth'; import {unstable_benchmark} from '@react-native/fantom'; -import Event from 'react-native/src/private/webapis/dom/events/Event'; -import EventTarget from 'react-native/src/private/webapis/dom/events/EventTarget'; import {EVENT_TARGET_GET_DECLARATIVE_LISTENER_KEY} from 'react-native/src/private/webapis/dom/events/internals/EventTargetInternals'; let event: Event; diff --git a/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-itest.js b/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-itest.js index 28dac4cb846..febb6cb696e 100644 --- a/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-itest.js +++ b/packages/react-native/src/private/webapis/dom/events/__tests__/EventTarget-itest.js @@ -11,9 +11,13 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import createEventTargetHierarchyWithDepth from './createEventTargetHierarchyWithDepth'; -import Event from 'react-native/src/private/webapis/dom/events/Event'; -import EventTarget from 'react-native/src/private/webapis/dom/events/EventTarget'; -import {dispatchTrustedEvent} from 'react-native/src/private/webapis/dom/events/internals/EventTargetInternals'; +import { + ReactNativeViewConfigRegistry, + dispatchNativeEvent, +} from 'react-native/react-private-interface'; + +const NATIVE_CUSTOM_EVENT_TYPE = 'topEventTargetTest'; +const CUSTOM_EVENT_TYPE = 'eventtargettest'; let listenerCallOrder = 0; @@ -54,6 +58,18 @@ function createListener( } describe('EventTarget', () => { + beforeAll(() => { + ReactNativeViewConfigRegistry.customDirectEventTypes[ + NATIVE_CUSTOM_EVENT_TYPE + ] = {registrationName: 'onEventTargetTest'}; + }); + + afterAll(() => { + delete ReactNativeViewConfigRegistry.customDirectEventTypes[ + NATIVE_CUSTOM_EVENT_TYPE + ]; + }); + it('should have 3 enumerable methods', () => { const methods = new Set([ 'addEventListener', @@ -261,18 +277,17 @@ describe('EventTarget', () => { }); }); - describe('internal `dispatchTrustedEvent`', () => { + describe('internal `dispatchNativeEvent`', () => { it('should set the `isTrusted` flag to `true`', () => { const eventTarget = new EventTarget(); const listener = createListener(); - eventTarget.addEventListener('custom', listener); + eventTarget.addEventListener(CUSTOM_EVENT_TYPE, listener); - const event = new Event('custom'); - - dispatchTrustedEvent(eventTarget, event); + dispatchNativeEvent(eventTarget, NATIVE_CUSTOM_EVENT_TYPE, {}); + const event = listener.mock.lastCall[0]; expect(event.isTrusted).toBe(true); }); }); @@ -321,6 +336,7 @@ describe('EventTarget', () => { }; eventTarget.addEventListener('custom', listenerFunction); + // $FlowFixMe[incompatible-type] This test intentionally uses an object listener. eventTarget.addEventListener('custom', listenerObject); const event = new Event('custom'); @@ -399,14 +415,11 @@ describe('EventTarget', () => { const listener = createListener(); - eventTarget.addEventListener('custom', listener); + eventTarget.addEventListener(CUSTOM_EVENT_TYPE, listener); - const event = new Event('custom'); - - expect(event.isTrusted).toBe(false); - - dispatchTrustedEvent(eventTarget, event); + dispatchNativeEvent(eventTarget, NATIVE_CUSTOM_EVENT_TYPE, {}); + const event = listener.mock.lastCall[0]; expect(event.isTrusted).toBe(true); eventTarget.dispatchEvent(event); diff --git a/packages/react-native/src/private/webapis/dom/events/__tests__/createEventTargetHierarchyWithDepth.js b/packages/react-native/src/private/webapis/dom/events/__tests__/createEventTargetHierarchyWithDepth.js index 9d15c208d07..75992d638aa 100644 --- a/packages/react-native/src/private/webapis/dom/events/__tests__/createEventTargetHierarchyWithDepth.js +++ b/packages/react-native/src/private/webapis/dom/events/__tests__/createEventTargetHierarchyWithDepth.js @@ -8,7 +8,6 @@ * @format */ -import EventTarget from '../EventTarget'; import {EVENT_TARGET_GET_THE_PARENT_KEY} from '../internals/EventTargetInternals'; /** diff --git a/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-itest.js b/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-itest.js index cbfd1b8982a..ea33a4427ce 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-itest.js +++ b/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReactNativeElement-itest.js @@ -30,7 +30,7 @@ import { unstable_NativeText as NativeText, } from 'react-native'; import {NativeVirtualText} from 'react-native/Libraries/Text/TextNativeComponent'; -import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; +import {ReactNativeFeatureFlags} from 'react-native/react-private-interface'; // The public imperative EventTarget API is not part of the static type of this // final class (it is only present at runtime, gated by feature flags), so we diff --git a/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReadOnlyText-itest.js b/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReadOnlyText-itest.js index ff8fdb757ec..0ab3194e0bb 100644 --- a/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReadOnlyText-itest.js +++ b/packages/react-native/src/private/webapis/dom/nodes/__tests__/ReadOnlyText-itest.js @@ -21,7 +21,7 @@ import nullthrows from 'nullthrows'; import * as React from 'react'; import {createRef} from 'react'; import {unstable_NativeText as NativeText} from 'react-native'; -import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; +import {ReactNativeFeatureFlags} from 'react-native/react-private-interface'; import ReadOnlyText from 'react-native/src/private/webapis/dom/nodes/ReadOnlyText'; function ensureReadOnlyText(value: unknown): ReadOnlyText { diff --git a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-benchmark-itest.js b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-benchmark-itest.js index 72fead1af44..c94dfbd29ce 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-benchmark-itest.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-benchmark-itest.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags enableIntersectionObserverByDefault:true * @flow strict-local * @format */ @@ -19,12 +20,9 @@ import nullthrows from 'nullthrows'; import * as React from 'react'; import {createRef} from 'react'; import {ScrollView, View} from 'react-native'; -import setUpIntersectionObserver from 'react-native/src/private/setup/setUpIntersectionObserver'; declare const IntersectionObserver: Class; -setUpIntersectionObserver(); - const nodeRef = createRef(); let node: HostInstance; const rootRef = createRef(); diff --git a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js index 0447b482cf4..483d23636d1 100644 --- a/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js +++ b/packages/react-native/src/private/webapis/intersectionobserver/__tests__/IntersectionObserver-itest.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags enableIntersectionObserverByDefault:true * @flow strict-local * @format */ @@ -20,13 +21,10 @@ import nullthrows from 'nullthrows'; import * as React from 'react'; import {createRef, useState} from 'react'; import {ScrollView, View} from 'react-native'; -import setUpIntersectionObserver from 'react-native/src/private/setup/setUpIntersectionObserver'; declare const IntersectionObserver: Class; declare const IntersectionObserverEntry: Class; -setUpIntersectionObserver(); - export function expectRectEquals( rect: DOMRectReadOnly, expected: {x: number, y: number, width: number, height: number}, diff --git a/packages/react-native/src/private/webapis/structuredClone/__tests__/structuredClone-itest.js b/packages/react-native/src/private/webapis/structuredClone/__tests__/structuredClone-itest.js index d867d4010b4..fa2df5d2f17 100644 --- a/packages/react-native/src/private/webapis/structuredClone/__tests__/structuredClone-itest.js +++ b/packages/react-native/src/private/webapis/structuredClone/__tests__/structuredClone-itest.js @@ -4,6 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags enableIntersectionObserverByDefault:true * @flow strict-local * @format */ @@ -18,7 +19,6 @@ import nullthrows from 'nullthrows'; import * as React from 'react'; import {createRef} from 'react'; import {View} from 'react-native'; -import setUpIntersectionObserver from 'react-native/src/private/setup/setUpIntersectionObserver'; import setUpMutationObserver from 'react-native/src/private/setup/setUpMutationObserver'; import DOMException from 'react-native/src/private/webapis/errors/DOMException'; import IntersectionObserver from 'react-native/src/private/webapis/intersectionobserver/IntersectionObserver'; @@ -26,7 +26,6 @@ import IntersectionObserverEntry from 'react-native/src/private/webapis/intersec import MutationObserver from 'react-native/src/private/webapis/mutationobserver/MutationObserver'; import structuredClone from 'react-native/src/private/webapis/structuredClone/structuredClone'; -setUpIntersectionObserver(); setUpMutationObserver(); function expectDataCloneError(fn: () => unknown) { diff --git a/private/react-native-fantom/src/__tests__/FantomFeatureFlags-itest.js b/private/react-native-fantom/src/__tests__/FantomFeatureFlags-itest.js index 094fa80d2b6..c3b30ccfc3e 100644 --- a/private/react-native-fantom/src/__tests__/FantomFeatureFlags-itest.js +++ b/private/react-native-fantom/src/__tests__/FantomFeatureFlags-itest.js @@ -9,7 +9,7 @@ * @format */ -import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags'; +import {ReactNativeFeatureFlags} from 'react-native/react-private-interface'; describe('FantomFeatureFlags', () => { it('allows overridding common feature flags', () => {