-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Comment): spread image props on CommentAvatar
- Loading branch information
1 parent
236bcf8
commit 1b3a123
Showing
6 changed files
with
37 additions
and
12 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
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 |
---|---|---|
@@ -1,17 +1,31 @@ | ||
import faker from 'faker' | ||
import React from 'react' | ||
|
||
import { htmlImageProps } from 'src/lib' | ||
import CommentAvatar from 'src/views/Comment/CommentAvatar' | ||
import * as common from 'test/specs/commonTests' | ||
import _ from 'lodash' | ||
|
||
describe('CommentAvatar', () => { | ||
common.isConformant(CommentAvatar) | ||
|
||
describe('src', () => { | ||
it('renders img', () => { | ||
const url = faker.image.imageUrl() | ||
shallow(<CommentAvatar src={url} />) | ||
.should.contain(<img src={url} />) | ||
it('passes to the "img" element', () => { | ||
const src = faker.image.imageUrl() | ||
const image = shallow(<CommentAvatar src={src} />).find('img') | ||
|
||
image.should.have.prop('src', src) | ||
}) | ||
}) | ||
|
||
describe('image props', () => { | ||
_.forEach(htmlImageProps, (propName) => { | ||
it(`passes "${propName}" to the "img" element`, () => { | ||
const propValue = faker.lorem.word() | ||
const image = shallow(<CommentAvatar {...{ [propName]: propValue }} />).find('img') | ||
|
||
image.should.have.prop(propName, propValue) | ||
}) | ||
}) | ||
}) | ||
}) |