Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated testIds in RN StoryListView to use kind #3129

Merged
merged 3 commits into from
Mar 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ SectionHeader.propTypes = {
selected: PropTypes.bool.isRequired,
};

const ListItem = ({ title, selected, onPress }) => (
const ListItem = ({ kind, title, selected, onPress }) => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a propType for this to make eslint happy =)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hypnosphi, thanks edited the file through github and missed the propTypes below.

<TouchableOpacity
key={title}
style={style.item}
onPress={onPress}
testID={`Storybook.ListItem.${title}`}
testID={`Storybook.ListItem.${kind}.${title}`}
accessibilityLabel={`Storybook.ListItem.${title}`}
>
<Text style={[style.itemText, selected && style.itemTextSelected]}>{title}</Text>
Expand All @@ -28,6 +28,7 @@ const ListItem = ({ title, selected, onPress }) => (

ListItem.propTypes = {
title: PropTypes.string.isRequired,
kind: PropTypes.string.isRequired,
onPress: PropTypes.func.isRequired,
selected: PropTypes.bool.isRequired,
};
Expand Down Expand Up @@ -92,10 +93,12 @@ export default class StoryListView extends Component {
render() {
return (
<ListView
testID="Storybook.ListView"
style={[style.list, { width: this.props.width }]}
renderRow={item => (
<ListItem
title={item.name}
kind={item.kind}
selected={
item.kind === this.props.selectedKind && item.name === this.props.selectedStory
}
Expand Down