Skip to content

Commit

Permalink
[Fabric] Implement IRangeValueProvider and Adjust IValueProvider Impl…
Browse files Browse the repository at this point in the history
…ementation (#14212)

* IRangeValue Provider

* Adjust ReadOnly to Use Prop Value

* Complete IRangeValueProvider Implementation

* Change files

* Update Snapshots
  • Loading branch information
chiaramooney authored Dec 19, 2024
1 parent 5b3faa4 commit 7e4bcc6
Show file tree
Hide file tree
Showing 31 changed files with 1,001 additions and 111 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "IRangeValue Provider",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,8 @@ class AccessibilityStateExamples extends React.Component {
</Text>
<TouchableHighlight
style={{width: 100, height: 50, backgroundColor: 'blue'}}
onPress={this.rangePress}>
onPress={this.rangePress}
testID="accessibilityValue-increment">
<Text>Range value increment</Text>
</TouchableHighlight>
<View
Expand All @@ -451,7 +452,9 @@ class AccessibilityStateExamples extends React.Component {
min: this.state.viewRangeMin,
max: this.state.viewRangeMax,
now: this.state.viewRangeNow,
}}>
}}
testID="accessibilityValue-number"
accessibilityState={{readOnly: true}}>
<Text>
The View's (accessibilityRole == adjustable, ie. Slider) properties
should be the following according to UIA: Min-{' '}
Expand All @@ -472,7 +475,10 @@ class AccessibilityStateExamples extends React.Component {
accessibilityValue={{
text: this.state.viewValueText,
}}
accessibilityRole="combobox">
accessibilityRole="combobox"
testID="accessibilityValue-text"
accessible
aria-readonly>
<Text>
The View's properties should be the following according to UIA:
Text- {this.state.viewValueText}
Expand Down
18 changes: 18 additions & 0 deletions packages/e2e-test-app-fabric/test/AccessibilityTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,22 @@ describe('Accessibility Tests', () => {
const dump = await dumpVisualTree('selection-container');
expect(dump).toMatchSnapshot();
});
test('Components can store range data by setting the min, max, and now of accessibilityValue', async () => {
await searchBox('Sta');
const componentsTab = await app.findElementByTestID(
'accessibilityValue-number',
);
await componentsTab.waitForDisplayed({timeout: 5000});
const dump = await dumpVisualTree('accessibilityValue-number');
expect(dump).toMatchSnapshot();
});
test('Components can store value data by setting the text of accessibilityValue', async () => {
await searchBox('Sta');
const componentsTab = await app.findElementByTestID(
'accessibilityValue-text',
);
await componentsTab.waitForDisplayed({timeout: 5000});
const dump = await dumpVisualTree('accessibilityValue-text');
expect(dump).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,120 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Accessibility Tests Components can store range data by setting the min, max, and now of accessibilityValue 1`] = `
{
"Automation Tree": {
"AutomationId": "accessibilityValue-number",
"ControlType": 50015,
"IsKeyboardFocusable": true,
"LocalizedControlType": "slider",
"RangeValuePattern.IsReadOnly": true,
"RangeValuePattern.Maximum": 125,
"RangeValuePattern.Minimum": 5,
"RangeValuePattern.Value": 10,
"__Children": [
{
"AutomationId": "",
"ControlType": 50020,
"LocalizedControlType": "text",
"Name": "The View's (accessibilityRole == adjustable, ie. Slider) properties should be the following according to UIA: Min- 5Max- 125Now- 10",
},
],
},
"Component Tree": {
"Type": "Microsoft.ReactNative.Composition.ViewComponentView",
"_Props": {
"TestId": "accessibilityValue-number",
},
"__Children": [
{
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
"_Props": {},
},
],
},
"Visual Tree": {
"Brush": {
"Brush Type": "ColorBrush",
"Color": "rgba(128, 128, 128, 255)",
},
"Comment": "accessibilityValue-number",
"Offset": "0, 0, 0",
"Size": "916, 50",
"Visual Type": "SpriteVisual",
"__Children": [
{
"Offset": "0, 0, 0",
"Size": "916, 19",
"Visual Type": "SpriteVisual",
"__Children": [
{
"Offset": "0, 0, 0",
"Size": "916, 19",
"Visual Type": "SpriteVisual",
},
],
},
],
},
}
`;

exports[`Accessibility Tests Components can store value data by setting the text of accessibilityValue 1`] = `
{
"Automation Tree": {
"AutomationId": "accessibilityValue-text",
"ControlType": 50003,
"LocalizedControlType": "combo box",
"ValuePattern.IsReadOnly": true,
"ValuePattern.Value": "testText",
"__Children": [
{
"AutomationId": "",
"ControlType": 50020,
"LocalizedControlType": "text",
"Name": "The View's properties should be the following according to UIA: Text- testText",
},
],
},
"Component Tree": {
"Type": "Microsoft.ReactNative.Composition.ViewComponentView",
"_Props": {
"TestId": "accessibilityValue-text",
},
"__Children": [
{
"Type": "Microsoft.ReactNative.Composition.ParagraphComponentView",
"_Props": {},
},
],
},
"Visual Tree": {
"Brush": {
"Brush Type": "ColorBrush",
"Color": "rgba(128, 128, 128, 255)",
},
"Comment": "accessibilityValue-text",
"Offset": "0, 0, 0",
"Size": "916, 50",
"Visual Type": "SpriteVisual",
"__Children": [
{
"Offset": "0, 0, 0",
"Size": "916, 20",
"Visual Type": "SpriteVisual",
"__Children": [
{
"Offset": "0, 0, 0",
"Size": "916, 20",
"Visual Type": "SpriteVisual",
},
],
},
],
},
}
`;

exports[`Accessibility Tests Elements can set accessibilityState:selected to false 1`] = `
{
"Automation Tree": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4908,7 +4908,6 @@ exports[`Home UIA Tree Dump Search Bar 1`] = `
"IsKeyboardFocusable": true,
"LocalizedControlType": "edit",
"Name": "Search...",
"ValuePattern.IsReadOnly": false,
},
"Component Tree": {
"Type": "Microsoft.ReactNative.Composition.WindowsTextInputComponentView",
Expand Down
Loading

0 comments on commit 7e4bcc6

Please sign in to comment.