Skip to content

Commit 83c75b0

Browse files
feat: add testID prop to ui components (#1444)
Co-authored-by: Fernanda Toledo <fertoledo93@gmail.com>
1 parent 75802b7 commit 83c75b0

File tree

7 files changed

+16
-6
lines changed

7 files changed

+16
-6
lines changed

src/components/ui/autocomplete/autocomplete.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,14 @@ export class Autocomplete extends React.Component<AutocompleteProps, State> {
205205
};
206206

207207
public render(): PopoverElement {
208-
const { placement, children, ...inputProps } = this.props;
208+
const { placement, children, testID, ...inputProps } = this.props;
209209

210210
return (
211211
<Popover
212212
ref={this.popoverRef}
213213
style={styles.popover}
214214
placement={placement}
215+
testID={testID}
215216
visible={this.state.listVisible}
216217
fullWidth={true}
217218
anchor={() => this.renderInputElement(inputProps)}

src/components/ui/datepicker/baseDatepicker.component.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export abstract class BaseDatepickerComponent<P, D = Date> extends React.Compone
229229
const {
230230
eva,
231231
style,
232+
testID,
232233
backdropStyle,
233234
controlStyle,
234235
placement,
@@ -242,7 +243,9 @@ export abstract class BaseDatepickerComponent<P, D = Date> extends React.Compone
242243
const evaStyle = this.getComponentStyle(eva.style);
243244

244245
return (
245-
<View style={style}>
246+
<View
247+
style={style}
248+
testID={testID}>
246249
<FalsyText
247250
style={[evaStyle.label, styles.label]}
248251
component={label}

src/components/ui/input/input.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,15 @@ export class Input extends React.Component<InputProps> implements WebEventRespon
254254
caption,
255255
accessoryLeft,
256256
accessoryRight,
257+
testID,
257258
...textInputProps
258259
} = this.props;
259260

260261
const evaStyle = this.getComponentStyle(eva.style);
261262

262263
return (
263264
<TouchableWithoutFeedback
265+
testID={testID}
264266
style={evaStyle.container}
265267
onPress={this.focus}>
266268
<FalsyText

src/components/ui/select/select.component.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ export class Select extends React.Component<SelectProps, State> {
455455

456456
return (
457457
<TouchableWeb
458+
testID={props.testID}
458459
style={[styles.input, evaStyle.input]}
459460
onPress={this.onPress}
460461
onMouseEnter={this.onMouseEnter}

src/components/ui/spinner/spinner.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ export class Spinner extends React.PureComponent<SpinnerProps> {
159159
const evaStyle = this.getComponentStyle(this.animation.toProps());
160160

161161
return (
162-
<View style={containerSize}>
162+
<View
163+
testID={this.props.testID}
164+
style={containerSize}>
163165
{this.renderArcElement(evaStyle.start, containerSize)}
164166
{this.renderArcElement(evaStyle.end, containerSize)}
165167
</View>

src/components/ui/tab/tabBar.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ export class TabBar extends React.Component<TabBarProps> {
180180
};
181181

182182
public render(): React.ReactElement<ViewProps> {
183-
const { eva, style, indicatorStyle, selectedIndex, children, ...viewProps } = this.props;
183+
const { eva, style, testID, indicatorStyle, selectedIndex, children, ...viewProps } = this.props;
184184
const evaStyle = this.getComponentStyle(eva.style);
185185
const tabElements: TabElement[] = this.renderTabElements(children);
186186

187187
return (
188-
<View>
188+
<View testID={testID}>
189189
<View
190190
{...viewProps}
191191
style={[evaStyle.container, styles.container, style]}>

src/components/ui/toggle/toggle.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,12 @@ export class Toggle extends React.Component<ToggleProps> implements PanResponder
370370
};
371371

372372
public render(): React.ReactElement<ViewProps> {
373-
const { eva, style, checked, children, ...touchableProps } = this.props;
373+
const { eva, style, checked, children, testID, ...touchableProps } = this.props;
374374
const evaStyle = this.getComponentStyle(eva.style);
375375

376376
return (
377377
<View
378+
testID={testID}
378379
{...this.panResponder.panHandlers}
379380
style={[styles.container, style]}>
380381
<TouchableWeb

0 commit comments

Comments
 (0)