Skip to content

Commit b9aed0e

Browse files
authored
Add Testing for accessibilityValue and Implement IValueProvider conditionally (#13544)
* Adjust Support for IValueProvider * Add Testing for accessibilityValue * Edit Examples * Change files * Add Extra Func * Fix Up Test Infra * Update Snapshots * Update Snapshots * Format * Fix Typo * Fix Typo * Format * Update ImageComponentTest.test.ts.snap * Update RNTesterApp-Fabric.cpp
1 parent a9e5ef1 commit b9aed0e

24 files changed

+512
-23
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Adjust Support for IValueProvider",
4+
"packageName": "react-native-windows",
5+
"email": "34109996+chiaramooney@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/@react-native-windows/tester/src/js/examples-win/Button/ButtonExample.windows.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,11 @@ exports.examples = [
217217
testID="accessibility_props"
218218
title="Submit Application"
219219
accessibilityLabel="Press to submit your application!"
220-
accessibilityRole="Button"
220+
accessibilityRole="button"
221221
accessibilityHint="Submit Button"
222222
accessibilityPosInSet={1}
223223
accessibilitySetSize={1}
224+
accessibilityValue={{Text: "Submit Application"}}
224225
/>
225226
);
226227
}}

packages/@react-native-windows/tester/src/js/examples/Pressable/PressableExample.windows.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function PressableFeedbackEvents() {
122122
testID="pressable_feedback_events_button"
123123
accessibilityLabel="pressable feedback events"
124124
accessibilityRole="button"
125+
accessibilityValue={{text: "Press Me"}}
125126
// [Windows
126127
onFocus={() => appendEvent('focus')}
127128
onBlur={() => appendEvent('blur')}
@@ -959,7 +960,7 @@ const examples = [
959960
onPress={() => {}}
960961
importantForAccessibility="no-hide-descendants"
961962
accessibilityHint="Button"
962-
accessibilityValue={0}>
963+
accessibilityValue={{text: "Child Pressable"}}>
963964
<Text>Parent Pressable</Text>
964965
<Pressable onPress={() => {}}>
965966
<Text>Child Pressable</Text>

packages/@react-native-windows/tester/src/js/examples/TextInput/TextInputExample.windows.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,20 @@ const examples: Array<RNTesterModuleExample> = [
827827
);
828828
},
829829
},
830+
{
831+
title: 'Searchbox',
832+
render: function (): React.Node {
833+
return (
834+
<View accessible testID="textinput-searchbox">
835+
<ExampleTextInput
836+
style={styles.singleLine}
837+
accessibilityRole="searchbox"
838+
defaultValue="Search"
839+
/>
840+
</View>
841+
);
842+
},
843+
},
830844
// Windows]
831845
];
832846

packages/@react-native-windows/tester/src/js/examples/Touchable/TouchableExample.windows.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class TouchableFeedbackEvents extends React.Component<{...}, $FlowFixMeState> {
162162
testID="touchable_feedback_events_button"
163163
accessibilityLabel="touchable feedback events"
164164
accessibilityRole="button"
165+
accessibilityValue={{text: "Press Me"}}
165166
onPress={() => this._appendEvent('press')}
166167
onPressIn={() => this._appendEvent('pressIn')}
167168
onPressOut={() => this._appendEvent('pressOut')}

packages/@react-native-windows/tester/src/js/examples/View/ViewExample.windows.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ class AccessibilityExample extends React.Component<
471471
accessibilityLabel="A View with accessibility values"
472472
accessibilityHint="Accessibility Hint"
473473
accessibilityRole="button"
474-
accessibilityValue={0}
474+
accessibilityValue={{now: this.state.tap}}
475475
accessibilityActions={[
476476
{name: 'cut', label: 'cut'},
477477
{name: 'copy', label: 'copy'},
@@ -503,6 +503,9 @@ class AccessibilityExample extends React.Component<
503503
<View importantForAccessibility="no-hide-descendants">
504504
<Text>This element should be hidden from accessibility.</Text>
505505
</View>
506+
<View accessible accessibilityValue={{now: this.state.tap}}>
507+
<Text>This sub-view should not have an accessibility value. It's control type does not support the value pattern.</Text>
508+
</View>
506509
</View>
507510
);
508511
}

packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,4 +803,10 @@ describe('TextInput Tests', () => {
803803
const dump = await dumpVisualTree('textinput-cursorColor');
804804
expect(dump).toMatchSnapshot();
805805
});
806+
test('TextInputs which have a searchbox role should also support the value pattern.', async () => {
807+
const component = await app.findElementByTestID('textinput-searchbox');
808+
await component.waitForDisplayed({timeout: 5000});
809+
const dump = await dumpVisualTree('textinput-searchbox');
810+
expect(dump).toMatchSnapshot();
811+
});
806812
});

packages/e2e-test-app-fabric/test/__snapshots__/HomeUIADump.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9627,6 +9627,7 @@ exports[`Home UIA Tree Dump Search Bar 1`] = `
96279627
"IsKeyboardFocusable": true,
96289628
"LocalizedControlType": "edit",
96299629
"Name": "Search...",
9630+
"ValuePattern.IsReadOnly": false,
96309631
},
96319632
"Component Tree": {
96329633
"Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView",

packages/e2e-test-app-fabric/test/__snapshots__/PressableComponentTest.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ exports[`Pressable Tests Pressables can have event handlers 1`] = `
686686
"IsKeyboardFocusable": true,
687687
"LocalizedControlType": "button",
688688
"Name": "pressable feedback events",
689+
"ValuePattern.Value": "Press Me",
689690
"__Children": [
690691
{
691692
"AutomationId": "",

0 commit comments

Comments
 (0)