Skip to content

Commit da9f234

Browse files
KevinGuljferrannp
authored andcommitted
fix: pass down testID from chip props to touchable for Detox tests. (#661)
1 parent 903afcc commit da9f234

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/components/Chip.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ type Props = React.ElementConfig<typeof Surface> & {|
6262
* @optional
6363
*/
6464
theme: Theme,
65+
/**
66+
* Pass down testID from chip props to touchable for Detox tests.
67+
*/
68+
testID?: string,
6569
|};
6670

6771
type State = {
@@ -132,6 +136,7 @@ class Chip extends React.Component<Props, State> {
132136
onClose,
133137
style,
134138
theme,
139+
testID,
135140
...rest
136141
} = this.props;
137142
const { dark, colors } = theme;
@@ -210,6 +215,7 @@ class Chip extends React.Component<Props, State> {
210215
accessibilityComponentType="button"
211216
accessibilityRole="button"
212217
accessibilityStates={accessibilityStates}
218+
testID={testID}
213219
>
214220
<View style={styles.content}>
215221
{avatar && !icon ? (

typings/components/Chip.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface ChipProps {
1313
onClose?: () => any;
1414
style?: any;
1515
theme?: ThemeShape;
16+
testID?: string;
1617
}
1718

1819
export declare class Chip extends React.Component<ChipProps> {}

0 commit comments

Comments
 (0)