Skip to content

Commit

Permalink
Merge pull request #3129 from storybooks/story-list-view-test-id-kind
Browse files Browse the repository at this point in the history
Updated testIds in RN StoryListView to use kind
  • Loading branch information
Hypnosphi authored Mar 2, 2018
2 parents 4da021e + fa2774c commit de93812
Showing 1 changed file with 5 additions and 2 deletions.
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 }) => (
<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

0 comments on commit de93812

Please sign in to comment.