decidim-comments/app/frontend/comments/comment.component.test.jsx in decidim-0.0.5 vs decidim-comments/app/frontend/comments/comment.component.test.jsx in decidim-0.0.6
- old
+ new
@@ -145,10 +145,15 @@
it("should not render reply button", () => {
const wrapper = shallow(<Comment comment={comment} session={session} />);
expect(wrapper.find('button.comment__reply')).not.to.be.present();
});
+
+ it("should not render the flag modal", () => {
+ const wrapper = shallow(<Comment comment={comment} session={session} />);
+ expect(wrapper.find('.flag-modal')).not.to.be.present();
+ });
});
it("should render a 'in favor' badge if comment's alignment is 1", () => {
comment.alignment = 1;
const wrapper = shallow(<Comment comment={comment} session={session} />);
@@ -157,9 +162,22 @@
it("should render a 'against' badge if comment's alignment is -1", () => {
comment.alignment = -1;
const wrapper = shallow(<Comment comment={comment} session={session} />);
expect(wrapper.find('span.alert.label')).to.have.text('Against');
+ });
+
+ it("should render the flag modal", () => {
+ const wrapper = shallow(<Comment comment={comment} session={session} />);
+ expect(wrapper.find('.flag-modal')).to.be.present();
+ });
+
+ describe("when user has already reported the comment", () => {
+ it("should not render the flag form", () => {
+ comment.alreadyReported = true;
+ const wrapper = shallow(<Comment comment={comment} session= {session} />);
+ expect(wrapper.find('.flag-modal form')).not.to.be.present();
+ });
});
describe("when the comment is votable", () => {
it("should render an UpVoteButton component", () => {
const wrapper = shallow(<Comment comment={comment} session={session} votable />);