diff --git a/packages/react-native/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-itest.js b/packages/react-native/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-itest.js new file mode 100644 index 000000000000..0fcae9f2e282 --- /dev/null +++ b/packages/react-native/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-itest.js @@ -0,0 +1,38 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import * as Fantom from '@react-native/fantom'; +import * as React from 'react'; +import {SafeAreaView, Text} from 'react-native'; + +describe('', () => { + it('renders with children', () => { + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render( + // collapsable={false} is needed to prevent the View (SafeAreaView falls + // back to View in non-iOS environments) from being optimized away in + // the Fantom output. + + Hello World! + , + ); + }); + + expect(root.getRenderedOutput({props: []}).toJSX()).toEqual( + + Hello World! + , + ); + }); +}); diff --git a/packages/react-native/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js b/packages/react-native/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js deleted file mode 100644 index e5387b169017..000000000000 --- a/packages/react-native/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import SafeAreaView from '../SafeAreaView'; - -const Text = require('../../../Text/Text').default; -const ReactNativeTestTools = require('../../../Utilities/ReactNativeTestTools'); -const View = require('../../View/View').default; -const React = require('react'); - -describe('', () => { - it('should render as expected', async () => { - await ReactNativeTestTools.expectRendersMatchingSnapshot( - 'SafeAreaView', - () => ( - - - Hello World! - - - ), - () => { - jest.dontMock('../SafeAreaView'); - }, - ); - }); -}); diff --git a/packages/react-native/Libraries/Components/SafeAreaView/__tests__/__snapshots__/SafeAreaView-test.js.snap b/packages/react-native/Libraries/Components/SafeAreaView/__tests__/__snapshots__/SafeAreaView-test.js.snap deleted file mode 100644 index 7c72daad2ffd..000000000000 --- a/packages/react-native/Libraries/Components/SafeAreaView/__tests__/__snapshots__/SafeAreaView-test.js.snap +++ /dev/null @@ -1,21 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - - - - Hello World! - - - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - - Hello World! - - - -`;