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
This commit is contained in:
Ruslan Shestopalyuk
2025-08-08 10:02:57 -07:00
committed by Facebook GitHub Bot
parent 1a58fdf172
commit 5a38948034
@@ -124,6 +124,47 @@ describe('<Text>', () => {
});
});
describe('id and nativeID', () => {
it(`has 'id' propagated correctly`, () => {
const root = Fantom.createRoot();
Fantom.runTask(() => {
root.render(<Text id="alpha">{TEST_TEXT}</Text>);
});
expect(root.getRenderedOutput({props: ['nativeID']}).toJSX()).toEqual(
<rn-paragraph nativeID={'alpha'}>{TEST_TEXT}</rn-paragraph>,
);
});
it(`has 'nativeID' propagated correctly`, () => {
const root = Fantom.createRoot();
Fantom.runTask(() => {
root.render(<Text nativeID="alpha">{TEST_TEXT}</Text>);
});
expect(root.getRenderedOutput({props: ['nativeID']}).toJSX()).toEqual(
<rn-paragraph nativeID={'alpha'}>{TEST_TEXT}</rn-paragraph>,
);
});
it(`has a precedence of 'id' over 'nativeID'`, () => {
const root = Fantom.createRoot();
Fantom.runTask(() => {
root.render(
<Text id="alpha" nativeID="gamma">
{TEST_TEXT}
</Text>,
);
});
expect(
root.getRenderedOutput({props: ['id', 'nativeID']}).toJSX(),
).toEqual(<rn-paragraph nativeID={'alpha'}>{TEST_TEXT}</rn-paragraph>);
});
});
describe('numberOfLines', () => {
let originalConsoleError = null;