diff --git a/__tests__/tests/components/ViewContainer.js b/__tests__/tests/components/ViewContainer.js new file mode 100644 index 000000000..414705675 --- /dev/null +++ b/__tests__/tests/components/ViewContainer.js @@ -0,0 +1,21 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import { ViewContainer, StyledViewContainer } from 'components'; + +describe('', () => { + it('should always render a ', () => { + const wrapper = shallow(); + expect(wrapper.find(StyledViewContainer).length).toBe(1); + expect(wrapper.find(StyledViewContainer).prop('children')).toBe(null); + }); + + it('should pass children to if present', () => { + const wrapper = shallow(test); + expect( + wrapper + .find(StyledViewContainer) + .children() + .text() + ).toBe('test'); + }); +}); diff --git a/src/components/view-container.component.js b/src/components/view-container.component.js index 332c425d2..22f3ec40e 100644 --- a/src/components/view-container.component.js +++ b/src/components/view-container.component.js @@ -7,7 +7,7 @@ type Props = { children?: React.Element<*>, }; -const Container = styled.View` +export const StyledViewContainer = styled.View` flex: 1; flex-direction: column; justify-content: flex-start; @@ -16,7 +16,7 @@ const Container = styled.View` `; export const ViewContainer = ({ children }: Props) => ( - {children} + {children} ); ViewContainer.defaultProps = {