Skip to content

Commit a5dfdd9

Browse files
M-i-k-e-lethanshar
authored andcommitted
Add missing testIDs (#549)
1 parent 13286ad commit a5dfdd9

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

demo/src/screens/MainScreen.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export default class MainScreen extends Component {
4444
const navigationStyle = this.getSearchNavigationStyle();
4545
navigationStyle.topBar.rightButtons.push({
4646
id: 'uilib.settingsButton',
47+
testID: 'uilib.settingsButton',
4748
enabled: true,
4849
icon: Assets.icons.settings,
4950
});
@@ -73,6 +74,7 @@ export default class MainScreen extends Component {
7374
rightButtons: [
7475
{
7576
id: 'uilib.searchButton',
77+
testID: 'uilib.searchButton',
7678
enabled: true,
7779
icon: Assets.icons.search,
7880
},
@@ -199,7 +201,7 @@ export default class MainScreen extends Component {
199201
<TextField
200202
ref={r => (this.input = r)}
201203
value={this.state.filterText}
202-
placeholder="Search your component.."
204+
placeholder="Search for your component..."
203205
onChangeText={this.filterExplorerScreens}
204206
onBlur={this.onSearchBoxBlur}
205207
style={{
@@ -211,6 +213,7 @@ export default class MainScreen extends Component {
211213
hideUnderline
212214
/>
213215
<Button
216+
testID={'SearchButton'}
214217
style={{marginRight: 16, marginTop: Constants.isIOS ? Constants.statusBarHeight : 0}}
215218
iconSource={Assets.icons.search}
216219
size={'small'}

demo/src/screens/SettingsScreen.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class SettingsScreen extends Component {
7171
Set default screen to open on app startup
7272
</Text>
7373
<Picker
74+
testID={'uilib.defaultScreenPicker'}
7475
placeholder="Pick default screen..."
7576
showSearch
7677
value={defaultScreen}

src/components/picker/PickerModal.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PickerModal extends BaseComponent {
4646
}
4747

4848
renderSearchInput() {
49-
const {showSearch, searchStyle, searchPlaceholder, onSearchChange, renderCustomSearch} = this.props;
49+
const {showSearch, searchStyle, searchPlaceholder, onSearchChange, renderCustomSearch, testID} = this.props;
5050

5151
if (showSearch) {
5252
if (_.isFunction(renderCustomSearch)) {
@@ -57,6 +57,7 @@ class PickerModal extends BaseComponent {
5757
<View style={this.styles.searchInputContainer}>
5858
<Image style={this.styles.searchIcon} source={Assets.icons.search}/>
5959
<TextInput
60+
testID={testID}
6061
ref={r => (this.search = r)}
6162
style={[this.styles.searchInput, {color: searchStyle.color}]}
6263
placeholderTextColor={searchStyle.placeholderTextColor}

src/components/picker/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ class Picker extends BaseComponent {
262262
searchPlaceholder,
263263
renderCustomSearch,
264264
renderCustomModal,
265-
listProps
265+
listProps,
266+
testID
266267
} = this.getThemeProps();
267268
const {showExpandableModal, selectedItemPosition} = this.state;
268269
const children = this.appendPropsToChildren(this.props.children);
@@ -279,6 +280,7 @@ class Picker extends BaseComponent {
279280

280281
return (
281282
<PickerModal
283+
testID={`${testID}.modal`}
282284
visible={showExpandableModal}
283285
scrollPosition={selectedItemPosition}
284286
enableModalBlur={enableModalBlur}

0 commit comments

Comments
 (0)