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
This commit is contained in:
Pieter De Baets
2025-09-01 06:31:04 -07:00
committed by Facebook GitHub Bot
parent 0f39fc3000
commit bae99efc26
@@ -339,18 +339,30 @@ describe('<View>', () => {
});
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(<View accessibilityElementsHidden={true} />);
root.render(
<View accessibilityElementsHidden={true} collapsable={false} />,
);
});
expect(
root
.getRenderedOutput({props: ['accessibilityElementsHidden']})
.toJSX(),
).toEqual(null);
expect(root.getRenderedOutput().toJSX()).toEqual(<rn-view />);
});
});
describe('aria-hidden', () => {
it('is mapped to importantForAccessibility', () => {
const root = Fantom.createRoot();
Fantom.runTask(() => {
root.render(<View aria-hidden={true} collapsable={false} />);
});
expect(root.getRenderedOutput().toJSX()).toEqual(
<rn-view importantForAccessibility="no-hide-descendants" />,
);
});
});