-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d0e556
commit 1d31612
Showing
10 changed files
with
160 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <FeedEvent>', () => { | ||
const events = _.times(3, () => { | ||
return { summary: faker.hacker.phrase() } | ||
}) | ||
|
||
mount(<Feed events={events} />) | ||
.should.have.exactly(3).descendants('FeedEvent') | ||
}) | ||
|
||
it('allows pass own key', () => { | ||
const key = faker.hacker.phrase() | ||
const events = [{ key, summary: faker.hacker.phrase() }] | ||
|
||
mount(<Feed events={events} />).find('FeedEvent').first() | ||
.should.have.prop('key', key) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <FeedLabel> with icon prop', () => { | ||
mount(<FeedEvent icon={faker.hacker.phrase()} />) | ||
.should.have.descendants('FeedLabel') | ||
}) | ||
|
||
it('renders <FeedLabel> with image prop', () => { | ||
mount(<FeedEvent image={faker.image.imageUrl()} />) | ||
.should.have.descendants('FeedLabel') | ||
}) | ||
|
||
describe('content props', () => { | ||
it('renders <FeedContent> with extraImages prop', () => { | ||
const images = _.times(3, () => faker.image.imageUrl()) | ||
mount(<FeedEvent extraImages={images} />).should.have.descendants('FeedContent') | ||
}) | ||
|
||
it('renders <FeedContent> with other content props', () => { | ||
const contentProps = ['content', 'date', 'extraText', 'meta', 'summary'] | ||
|
||
contentProps.map(propKey => { | ||
const props = { [propKey]: faker.hacker.phrase() } | ||
mount(<FeedEvent {...props} />).should.have.descendants('FeedContent') | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(<FeedExtra text={text} />).should.contain(text) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <img> with string', () => { | ||
const src = faker.image.imageUrl() | ||
|
||
shallow(<FeedLabel image={src} />).should.contain(<img src={src} />) | ||
}) | ||
|
||
it('renders node', () => { | ||
const img = <img src={faker.image.imageUrl()} /> | ||
|
||
shallow(<FeedLabel image={img} />).should.contain(img) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(<FeedLike like={text} />).should.contain.text(text) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <FeedLike> with like prop', () => { | ||
mount(<FeedMeta like={faker.hacker.phrase()} />) | ||
.should.have.descendants('FeedLike') | ||
}) | ||
|
||
it('renders text with meta prop', () => { | ||
const text = faker.hacker.phrase() | ||
|
||
shallow(<FeedMeta meta={text} />).should.contain.text(text) | ||
}) | ||
}) |