From 5a3894803453a4e693124fc9be710fa802d47f77 Mon Sep 17 00:00:00 2001 From: Ruslan Shestopalyuk Date: Fri, 8 Aug 2025 10:02:57 -0700 Subject: [PATCH] e2e test for Text.id/nativeID (#53170) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53170 # Changelog: [Internal] - As in the title. Reviewed By: andrewdacenko Differential Revision: D79887689 fbshipit-source-id: a8a6a16a0fbf3f1481758a2d91c7813d51a4d9d1 --- .../Libraries/Text/__tests__/Text-itest.js | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/react-native/Libraries/Text/__tests__/Text-itest.js b/packages/react-native/Libraries/Text/__tests__/Text-itest.js index 924a86eb250..e5c96606216 100644 --- a/packages/react-native/Libraries/Text/__tests__/Text-itest.js +++ b/packages/react-native/Libraries/Text/__tests__/Text-itest.js @@ -124,6 +124,47 @@ describe('', () => { }); }); + describe('id and nativeID', () => { + it(`has 'id' propagated correctly`, () => { + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render({TEST_TEXT}); + }); + + expect(root.getRenderedOutput({props: ['nativeID']}).toJSX()).toEqual( + {TEST_TEXT}, + ); + }); + + it(`has 'nativeID' propagated correctly`, () => { + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render({TEST_TEXT}); + }); + + expect(root.getRenderedOutput({props: ['nativeID']}).toJSX()).toEqual( + {TEST_TEXT}, + ); + }); + it(`has a precedence of 'id' over 'nativeID'`, () => { + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render( + + {TEST_TEXT} + , + ); + }); + + expect( + root.getRenderedOutput({props: ['id', 'nativeID']}).toJSX(), + ).toEqual({TEST_TEXT}); + }); + }); + describe('numberOfLines', () => { let originalConsoleError = null;