Sha256: 113f588969e35dc09585cad1b1312988780a299a811157552517a688f5c05ff0
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
import { shallow } from "enzyme"; import * as React from "react"; import { DownVoteButton } from "./down_vote_button.component"; import VoteButton from "./vote_button.component"; import generateCommentsData from "../support/generate_comments_data"; import { DownVoteFragment } from "../support/schema"; describe("<DownVoteButton />", () => { let comment: DownVoteFragment; const downVote = jasmine.createSpy("downVote"); beforeEach(() => { const commentsData = generateCommentsData(1); comment = commentsData[0]; }); it("should render a VoteButton component with the correct props", () => { const wrapper = shallow(<DownVoteButton comment={comment} downVote={downVote} />); expect(wrapper.find(VoteButton).prop("buttonClassName")).toEqual("comment__votes--down"); expect(wrapper.find(VoteButton).prop("iconName")).toEqual("icon-chevron-bottom"); expect(wrapper.find(VoteButton).prop("votes")).toEqual(comment.downVotes); }); it("should pass disabled prop as true if comment downVoted is true", () => { comment.downVoted = true; const wrapper = shallow(<DownVoteButton comment={comment} downVote={downVote} />); expect(wrapper.find(VoteButton).prop("disabled")).toBeTruthy(); }); it("should pass disabled prop as true if comment downVoted is true", () => { comment.downVoted = true; const wrapper = shallow(<DownVoteButton comment={comment} downVote={downVote} />); expect(wrapper.find(VoteButton).prop("disabled")).toBeTruthy(); }); });
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
decidim-comments-0.1.0 | app/frontend/comments/down_vote_button.component.test.tsx |
decidim-0.1.0 | decidim-comments/app/frontend/comments/down_vote_button.component.test.tsx |