add accessibility and testId props and virtual nodes to support e2e tests tools (#2001)

PR adding accessibility and testId props and virtual nodes to support e2e tests tools and provide general accessibility support.

Co-authored-by: yonatan.altaraz <yonatan.altaraz@khealth.ai>
Co-authored-by: galkahana <gal.kahana@hotmail.com>
This commit is contained in:
toter3
2023-03-22 14:01:09 +02:00
committed by GitHub
parent eaf79ea3ee
commit d03604797f
8 changed files with 110 additions and 0 deletions
+18
View File
@@ -49,6 +49,9 @@ export default function extractProps(
display?: string;
opacity?: NumberProp;
onLayout?: () => void;
testID?: string;
accessibilityLabel?: string;
accessible?: boolean;
} & TransformProps &
ResponderProps &
StrokeProps &
@@ -68,6 +71,9 @@ export default function extractProps(
markerStart = marker,
markerMid = marker,
markerEnd = marker,
testID,
accessibilityLabel,
accessible,
} = props;
const extracted: extractedProps = {};
@@ -111,6 +117,18 @@ export default function extractProps(
extracted.name = String(id);
}
if (testID) {
extracted.testID = String(testID);
}
if (accessibilityLabel) {
extracted.accessibilityLabel = String(accessibilityLabel);
}
if (accessible) {
extracted.accessible = Boolean(accessible);
}
if (clipRule) {
extracted.clipRule = clipRules[clipRule] === 0 ? 0 : 1;
}
+3
View File
@@ -276,6 +276,9 @@ export type extractedProps = {
clipPath?: string;
clipRule?: number;
display?: string;
testID?: string;
accessibilityLabel?: string;
accessible?: boolean;
[touchableProperty: string]: unknown;
};