diff --git a/__tests__/ScreenWrapper.test.tsx b/__tests__/ScreenWrapper.test.tsx new file mode 100644 index 00000000..9afcc25f --- /dev/null +++ b/__tests__/ScreenWrapper.test.tsx @@ -0,0 +1,33 @@ +/** + * @format + */ + +import React from 'react'; +import {AccessibilityInfo, View} from 'react-native'; +import {act, create} from 'react-test-renderer'; +import {ScreenWrapper} from '../src/components/ScreenWrapper'; + +test('announces when the navigation menu is expanded', () => { + const announceSpy = jest + .spyOn(AccessibilityInfo, 'announceForAccessibility') + .mockImplementation(() => {}); + + let tree; + act(() => { + tree = create( + + + , + ); + }); + + const navigationMenu = tree.root.findByProps({ + accessibilityLabel: 'Navigation menu', + }); + + act(() => { + navigationMenu.props.onPress(); + }); + + expect(announceSpy).toHaveBeenCalledWith('Navigation menu expanded'); +}); diff --git a/src/components/ScreenWrapper.tsx b/src/components/ScreenWrapper.tsx index eded6f95..bc083fc5 100644 --- a/src/components/ScreenWrapper.tsx +++ b/src/components/ScreenWrapper.tsx @@ -6,6 +6,7 @@ import { TouchableHighlight, Text, PlatformColor, + AccessibilityInfo, Dimensions, Easing, useAnimatedValue,