Fix invalid HTML in comment votes
We forgot to change the `span` tag when we replaced links with buttons
in commit ba0d21b46.
This commit is contained in:
@@ -1720,6 +1720,11 @@ table {
|
||||
}
|
||||
}
|
||||
|
||||
.in-favor,
|
||||
.against {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.in-favor button {
|
||||
@include like-unlike-icon(thumbs-up, $like);
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
<%= t("comments.comment.votes", count: comment.total_votes) %>
|
||||
|
|
||||
|
||||
<span class="in-favor">
|
||||
<div class="in-favor">
|
||||
<%= render Shared::VoteButtonComponent.new(comment,
|
||||
value: "yes",
|
||||
title: t("votes.agree")) %>
|
||||
<%= comment.total_likes %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<span class="against">
|
||||
<div class="against">
|
||||
<%= render Shared::VoteButtonComponent.new(comment,
|
||||
value: "no",
|
||||
title: t("votes.disagree")) %>
|
||||
<%= comment.total_dislikes %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,14 @@ describe Comments::VotesComponent do
|
||||
let(:comment) { create(:comment, user: user) }
|
||||
let(:component) { Comments::VotesComponent.new(comment) }
|
||||
|
||||
it "generates valid HTML" do
|
||||
render_inline component
|
||||
|
||||
expect(page).not_to have_css "span form"
|
||||
expect(page).to have_css "div.in-favor > form"
|
||||
expect(page).to have_css "div.against > form"
|
||||
end
|
||||
|
||||
describe "aria-pressed and method attributes" do
|
||||
it "have expected values when the in-favor button is pressed" do
|
||||
comment.vote_by(voter: user, vote: "yes")
|
||||
|
||||
Reference in New Issue
Block a user