Created
October 10, 2017 14:27
-
-
Save nicholasess/1f1d46a4c311d716f61f5c4736c387da to your computer and use it in GitHub Desktop.
snapshot
This file contains hidden or 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
const Content = ({ content, handleVote}) => ( | |
<Container> | |
<Info> | |
<Thumb | |
style={{ | |
backgroundImage: `url(${changeImage.imageFromContent( | |
content.img_130 | |
)})` | |
}} | |
/> | |
{content.voted ? ( | |
<ButtonUnvote onClick={handleVote}> | |
<Icon icon={"i"} color={Color.green} /> | |
{content.votes} | |
</ButtonUnvote> | |
) : ( | |
<ButtonVote onClick={handleVote}> | |
<Icon icon={"&"} color={Color.white} /> | |
{content.votes} | |
</ButtonVote> | |
)} | |
</Info> | |
<Info2> | |
<Title href={content.url}>{content.title}</Title> | |
<div> | |
<TypeIcon type={content.type} /> | |
<Day>{content.published_at}</Day> | |
</div> | |
</Info2> | |
</Container> | |
); | |
Content.getDefaultProps = { | |
handleVote: () => {} | |
}; |
This file contains hidden or 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
// Jest Snapshot v1, https://goo.gl/fbAQLP | |
exports[`State initial of content 1`] = ` | |
<div | |
className="sc-bwzfXH jhxTsW" | |
> | |
<div | |
className="sc-bZQynM jZVjBt" | |
> | |
<div | |
className="sc-htpNat rTBha" | |
style={ | |
Object { | |
"backgroundImage": "url(https://welearnfs.s3.amazonaws.com/content_images/)", | |
} | |
} | |
/> | |
<div | |
className="sc-EHOje fIDzKW sc-bxivhb iSfDY" | |
onClick={undefined} | |
> | |
<span | |
className="icon sc-bdVaJa ecjBLC" | |
color="#fff" | |
data-icon="&" | |
/> | |
</div> | |
</div> | |
<div | |
className="sc-gzVnrw duPkhC" | |
> | |
<a | |
className="sc-htoDjs dFzTxy" | |
href={undefined} | |
/> | |
<div> | |
<span | |
className="icon sc-bdVaJa kftMBX" | |
color="#000" | |
data-icon="N" | |
/> | |
<span | |
className="sc-dnqmqq cKDwls" | |
/> | |
</div> | |
</div> | |
</div> | |
`; |
This file contains hidden or 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
import React from "react"; | |
import Content from "./content"; | |
import renderer from "react-test-renderer"; | |
var content = { | |
img_130: "" | |
}; | |
test("State initial of content", () => { | |
const inputInitial = renderer.create(<Content content={content} />); | |
let treeInputInitial = inputInitial.toJSON(); | |
expect(treeInputInitial).toMatchSnapshot(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment