Skip to content

Commit bae99ef

Browse files
javachefacebook-github-bot
authored andcommitted
Add test for aria-hidden to View (#53548)
Summary: Pull Request resolved: #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
1 parent 0f39fc3 commit bae99ef

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

  • packages/react-native/Libraries/Components/View/__tests__

packages/react-native/Libraries/Components/View/__tests__/View-itest.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,18 +339,30 @@ describe('<View>', () => {
339339
});
340340

341341
describe('accessibilityElementsHidden', () => {
342-
it('is not propagated to mounting layer, it is iOS only prop', () => {
342+
it("is an iOS-only prop and ignored by Fantom (Android)'s BaseViewConfig", () => {
343343
const root = Fantom.createRoot();
344344

345345
Fantom.runTask(() => {
346-
root.render(<View accessibilityElementsHidden={true} />);
346+
root.render(
347+
<View accessibilityElementsHidden={true} collapsable={false} />,
348+
);
347349
});
348350

349-
expect(
350-
root
351-
.getRenderedOutput({props: ['accessibilityElementsHidden']})
352-
.toJSX(),
353-
).toEqual(null);
351+
expect(root.getRenderedOutput().toJSX()).toEqual(<rn-view />);
352+
});
353+
});
354+
355+
describe('aria-hidden', () => {
356+
it('is mapped to importantForAccessibility', () => {
357+
const root = Fantom.createRoot();
358+
359+
Fantom.runTask(() => {
360+
root.render(<View aria-hidden={true} collapsable={false} />);
361+
});
362+
363+
expect(root.getRenderedOutput().toJSX()).toEqual(
364+
<rn-view importantForAccessibility="no-hide-descendants" />,
365+
);
354366
});
355367
});
356368

0 commit comments

Comments
 (0)