Skip to content

Commit 8175ac6

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
add fantom test for View.accessibilityRole
Summary: changelog: [internal] add test for View.accessibilityRole. Reviewed By: rubennorte Differential Revision: D74247897
1 parent c34987f commit 8175ac6

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,29 @@ describe('margin style', () => {
168168
);
169169
});
170170
});
171+
172+
describe('accessibilityRole', () => {
173+
it('is propagated to the mounting layer', () => {
174+
const root = Fantom.createRoot();
175+
176+
Fantom.runTask(() => {
177+
root.render(<View accessibilityRole={'button'} accessible={true} />);
178+
});
179+
180+
expect(
181+
root.getRenderedOutput({props: ['accessibilityRole']}).toJSX(),
182+
).toEqual(<rn-view accessibilityRole="button" />);
183+
});
184+
185+
it('does not unflatten view', () => {
186+
const root = Fantom.createRoot();
187+
188+
Fantom.runTask(() => {
189+
root.render(<View accessibilityRole={'button'} />);
190+
});
191+
192+
expect(
193+
root.getRenderedOutput({props: ['accessibilityRole']}).toJSX(),
194+
).toEqual(null);
195+
});
196+
});

packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ SharedDebugStringConvertibleList AccessibilityProps::getDebugProps() const {
305305
const auto& defaultProps = AccessibilityProps();
306306
return SharedDebugStringConvertibleList{
307307
debugStringConvertibleItem("testID", testId, defaultProps.testId),
308+
debugStringConvertibleItem(
309+
"accessibilityRole",
310+
accessibilityRole,
311+
defaultProps.accessibilityRole),
308312
};
309313
}
310314
#endif // RN_DEBUG_STRING_CONVERTIBLE

0 commit comments

Comments
 (0)