app/frontend/comments/vote_button_component.test.jsx in decidim-comments-0.0.2 vs app/frontend/comments/vote_button_component.test.jsx in decidim-comments-0.0.3

- old
+ new

@@ -19,20 +19,25 @@ const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />); expect(wrapper.find('button.vote-button')).to.be.present(); }); it("should render a Icon component with the correct name prop", () => { - const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />); + const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />); expect(wrapper.find(Icon)).to.have.prop("name").equal('vote-icon'); }); it("should call the voteAction prop on click", () => { const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} />); wrapper.find('button').simulate('click'); expect(voteAction).to.have.been.called; }); it("should disable the button based on the disabled prop", () => { - const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} disabled />); + const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} disabled />); expect(wrapper.find('button')).to.be.disabled(); + }) + + it("should render a button with the given selectedClass", () => { + const wrapper = shallow(<VoteButton votes={10} buttonClassName="vote-button" iconName="vote-icon" voteAction={voteAction} disabled selectedClass="is-vote-selected" />); + expect(wrapper.find('.is-vote-selected')).to.be.present(); }) });