From bae99efc2628ab0d76b51254fc89beaaa1bb9319 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Mon, 1 Sep 2025 06:31:04 -0700 Subject: [PATCH] Add test for aria-hidden to View (#53548) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53548 Add tests to View similar to D81043503, and clarify why `accessibilityElementsHidden` does not show up in the rendered component tree (because Fantom uses the Android platform for bundling, and Android does not have accessibilityElementsHidden in its BaseViewConfig. Changelog: [Internal] Reviewed By: rshest Differential Revision: D81437063 fbshipit-source-id: aa10573aee686d1d650b152365607877f34f8508 --- .../Components/View/__tests__/View-itest.js | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/react-native/Libraries/Components/View/__tests__/View-itest.js b/packages/react-native/Libraries/Components/View/__tests__/View-itest.js index 7822b5f1053..2c2779ecd0d 100644 --- a/packages/react-native/Libraries/Components/View/__tests__/View-itest.js +++ b/packages/react-native/Libraries/Components/View/__tests__/View-itest.js @@ -339,18 +339,30 @@ describe('', () => { }); describe('accessibilityElementsHidden', () => { - it('is not propagated to mounting layer, it is iOS only prop', () => { + it("is an iOS-only prop and ignored by Fantom (Android)'s BaseViewConfig", () => { const root = Fantom.createRoot(); Fantom.runTask(() => { - root.render(); + root.render( + , + ); }); - expect( - root - .getRenderedOutput({props: ['accessibilityElementsHidden']}) - .toJSX(), - ).toEqual(null); + expect(root.getRenderedOutput().toJSX()).toEqual(); + }); + }); + + describe('aria-hidden', () => { + it('is mapped to importantForAccessibility', () => { + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render(); + }); + + expect(root.getRenderedOutput().toJSX()).toEqual( + , + ); }); });