Skip to content

Commit

Permalink
Merge 109ae28 into a9ae840
Browse files Browse the repository at this point in the history
  • Loading branch information
machour committed Oct 26, 2017
2 parents a9ae840 + 109ae28 commit bd0349a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
23 changes: 21 additions & 2 deletions __tests__/tests/components/EntityInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import user from 'testData/api/user';
import { EntityInfo } from 'components';

describe('<EntityInfo />', () => {
it('correctly renders organization', () => {
it('should render organization correctly', () => {
const wrapper = shallow(<EntityInfo entity={organization} language="en" />);

expect(wrapper.find({ title: 'Location' }).prop('subtitle')).toEqual(
Expand All @@ -21,7 +21,7 @@ describe('<EntityInfo />', () => {
);
});

it('correctly renders users', () => {
it('should render users correctly', () => {
const wrapper = shallow(
<EntityInfo entity={user} orgs={[organization]} language="en" />
);
Expand All @@ -39,4 +39,23 @@ describe('<EntityInfo />', () => {
'@GitHub'
);
});

it('should render user without organizations', () => {
const wrapper = shallow(
<EntityInfo entity={user} orgs={[]} language="en" />
);

expect(wrapper.find({ title: 'Location' }).prop('subtitle')).toEqual(
'San Francisco'
);
expect(wrapper.find({ title: 'Email' }).prop('subtitle')).toEqual(
'octocat@github.com'
);
expect(wrapper.find({ title: 'Website' }).prop('subtitle')).toEqual(
'https://github.com/blog'
);
expect(wrapper.find({ title: 'Company' }).prop('subtitle')).toEqual(
'@GitHub'
);
});
});
14 changes: 11 additions & 3 deletions src/components/entity-info.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ const StyledListItem = styled(ListItem).attrs({
subtitleStyle: {
color: colors.greyDark,
...fonts.fontPrimary,
fontWeight: 'normal',
},
underlayColor: props => (props.unknown ? null : colors.greyLight),
hideChevron: props => props.unknown,
wrapperStyle: {
borderBottomColor: colors.greyLight,
borderBottomWidth: 1,
padding: 10,
marginLeft: 0,
},
underlayColor: props => (props.transparentChevron ? null : colors.greyLight),
chevronColor: props =>
props.transparentChevron ? colors.transparent : undefined,
})``;

const getBlogLink = url =>
Expand Down Expand Up @@ -74,7 +82,7 @@ export const EntityInfo = ({ entity, orgs, locale, navigation }: Props) => {
}}
subtitle={entity.company}
onPress={() => navigateToCompany(entity.company, orgs, navigation)}
unknown={companyInOrgs(entity.company, orgs)}
transparentChevron={!companyInOrgs(entity.company, orgs)}
/>
)}

Expand Down

0 comments on commit bd0349a

Please sign in to comment.