diff --git a/src/views/Feed/FeedContent.js b/src/views/Feed/FeedContent.js index cfe4600e66..f5f172ec74 100644 --- a/src/views/Feed/FeedContent.js +++ b/src/views/Feed/FeedContent.js @@ -44,29 +44,29 @@ FeedContent.propTypes = { /** Primary content of the FeedContent. Mutually exclusive with children. */ content: customPropTypes.all([ customPropTypes.mutuallyExclusive(['children']), - PropTypes.node, + PropTypes.string, ]), /** An event can contain a date. */ - date: PropTypes.node, + date: PropTypes.string, /** Shorthand for FeedExtra with prop images. */ extraImages: customPropTypes.all([ customPropTypes.mutuallyExclusive(['children', 'content']), - PropTypes.arrayOf(PropTypes.node), + PropTypes.arrayOf(PropTypes.string), ]), /** Shorthand for FeedExtra with prop text. */ extraText: customPropTypes.all([ customPropTypes.mutuallyExclusive(['children', 'content']), - PropTypes.node, + PropTypes.string, ]), /** A shorthand for FeedMeta. */ - meta: PropTypes.node, + meta: PropTypes.string, /** A shorthand for FeedSummary. */ - summary: PropTypes.node, + summary: PropTypes.string, } export default FeedContent diff --git a/src/views/Feed/FeedExtra.js b/src/views/Feed/FeedExtra.js index 5a7fd8133b..0162d19da5 100644 --- a/src/views/Feed/FeedExtra.js +++ b/src/views/Feed/FeedExtra.js @@ -53,8 +53,7 @@ FeedExtra.propTypes = { customPropTypes.mutuallyExclusive(['images']), PropTypes.oneOfType([ PropTypes.bool, - PropTypes.node, - PropTypes.arrayOf(PropTypes.string), + PropTypes.string, ]), ]), } diff --git a/src/views/Feed/FeedLike.js b/src/views/Feed/FeedLike.js index 9b18c62148..a51f625f45 100644 --- a/src/views/Feed/FeedLike.js +++ b/src/views/Feed/FeedLike.js @@ -43,7 +43,7 @@ FeedLike.propTypes = { /** Primary content of the FeedLike, mutually exclusive with children prop. */ like: customPropTypes.all([ customPropTypes.mutuallyExclusive(['children']), - PropTypes.node, + PropTypes.string, ]), } diff --git a/src/views/Feed/FeedMeta.js b/src/views/Feed/FeedMeta.js index 47c5be1f77..ddbe0af488 100644 --- a/src/views/Feed/FeedMeta.js +++ b/src/views/Feed/FeedMeta.js @@ -39,8 +39,8 @@ FeedMeta.propTypes = { /** Primary content of the FeedMeta. Mutually exclusive with children. */ meta: customPropTypes.all([ - customPropTypes.mutuallyExclusive(['content']), - PropTypes.node, + customPropTypes.mutuallyExclusive(['children']), + PropTypes.string, ]), } diff --git a/test/specs/views/Feed/Feed-test.js b/test/specs/views/Feed/Feed-test.js new file mode 100644 index 0000000000..c803c7e23b --- /dev/null +++ b/test/specs/views/Feed/Feed-test.js @@ -0,0 +1,32 @@ +import _ from 'lodash' +import faker from 'faker' +import React from 'react' + +import * as common from 'test/specs/commonTests' +import Feed from 'src/views/Feed/Feed' + +describe('Feed', () => { + common.hasUIClassName() + common.isConformant(Feed) + common.propValueOnlyToClassName(Feed, 'size') + common.rendersChildren(Feed) + + describe('events prop', () => { + it('renders ', () => { + const events = _.times(3, () => { + return { summary: faker.hacker.phrase() } + }) + + mount() + .should.have.exactly(3).descendants('FeedEvent') + }) + + it('allows pass own key', () => { + const key = faker.hacker.phrase() + const events = [{ key, summary: faker.hacker.phrase() }] + + mount().find('FeedEvent').first() + .should.have.prop('key', key) + }) + }) +}) diff --git a/test/specs/views/Feed/FeedEvent-test.js b/test/specs/views/Feed/FeedEvent-test.js new file mode 100644 index 0000000000..67bfb29946 --- /dev/null +++ b/test/specs/views/Feed/FeedEvent-test.js @@ -0,0 +1,37 @@ +import _ from 'lodash' +import faker from 'faker' +import React from 'react' + +import * as common from 'test/specs/commonTests' +import FeedEvent from 'src/views/Feed/FeedEvent' + +describe('FeedEvent', () => { + common.isConformant(FeedEvent) + common.rendersChildren(FeedEvent) + + it('renders with icon prop', () => { + mount() + .should.have.descendants('FeedLabel') + }) + + it('renders with image prop', () => { + mount() + .should.have.descendants('FeedLabel') + }) + + describe('content props', () => { + it('renders with extraImages prop', () => { + const images = _.times(3, () => faker.image.imageUrl()) + mount().should.have.descendants('FeedContent') + }) + + it('renders with other content props', () => { + const contentProps = ['content', 'date', 'extraText', 'meta', 'summary'] + + contentProps.map(propKey => { + const props = { [propKey]: faker.hacker.phrase() } + mount().should.have.descendants('FeedContent') + }) + }) + }) +}) diff --git a/test/specs/views/Feed/FeedExtra-test.js b/test/specs/views/Feed/FeedExtra-test.js new file mode 100644 index 0000000000..8ce64f61f4 --- /dev/null +++ b/test/specs/views/Feed/FeedExtra-test.js @@ -0,0 +1,18 @@ +import faker from 'faker' +import React from 'react' + +import * as common from 'test/specs/commonTests' +import FeedExtra from 'src/views/Feed/FeedExtra' + +describe('FeedExtra', () => { + common.isConformant(FeedExtra) + common.propKeyOnlyToClassName(FeedExtra, 'images') + common.propKeyOnlyToClassName(FeedExtra, 'text') + common.rendersChildren(FeedExtra) + + it('renders text with text prop', () => { + const text = faker.hacker.phrase() + + shallow().should.contain(text) + }) +}) diff --git a/test/specs/views/Feed/FeedLabel-test.js b/test/specs/views/Feed/FeedLabel-test.js new file mode 100644 index 0000000000..0bfa941658 --- /dev/null +++ b/test/specs/views/Feed/FeedLabel-test.js @@ -0,0 +1,25 @@ +import faker from 'faker' +import React from 'react' + +import * as common from 'test/specs/commonTests' +import FeedLabel from 'src/views/Feed/FeedLabel' + +describe('FeedLabel', () => { + common.isConformant(FeedLabel) + common.implementsIconProp(FeedLabel) + common.rendersChildren(FeedLabel) + + describe('image prop', () => { + it('renders with string', () => { + const src = faker.image.imageUrl() + + shallow().should.contain() + }) + + it('renders node', () => { + const img = + + shallow().should.contain(img) + }) + }) +}) diff --git a/test/specs/views/Feed/FeedLike-test.js b/test/specs/views/Feed/FeedLike-test.js new file mode 100644 index 0000000000..4ffc290852 --- /dev/null +++ b/test/specs/views/Feed/FeedLike-test.js @@ -0,0 +1,17 @@ +import faker from 'faker' +import React from 'react' + +import * as common from 'test/specs/commonTests' +import FeedLike from 'src/views/Feed/FeedLike' + +describe('FeedLike', () => { + common.isConformant(FeedLike) + common.implementsIconProp(FeedLike) + common.rendersChildren(FeedLike) + + it('renders text with like prop', () => { + const text = faker.hacker.phrase() + + shallow().should.contain.text(text) + }) +}) diff --git a/test/specs/views/Feed/FeedMeta-test.js b/test/specs/views/Feed/FeedMeta-test.js new file mode 100644 index 0000000000..02a3f8b7e9 --- /dev/null +++ b/test/specs/views/Feed/FeedMeta-test.js @@ -0,0 +1,21 @@ +import faker from 'faker' +import React from 'react' + +import * as common from 'test/specs/commonTests' +import FeedMeta from 'src/views/Feed/FeedMeta' + +describe('FeedMeta', () => { + common.isConformant(FeedMeta) + common.rendersChildren(FeedMeta) + + it('renders with like prop', () => { + mount() + .should.have.descendants('FeedLike') + }) + + it('renders text with meta prop', () => { + const text = faker.hacker.phrase() + + shallow().should.contain.text(text) + }) +})