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:
Javi Martín
2024-03-05 00:36:12 +01:00
parent 8ac1acc5ea
commit a101608ebe
3 changed files with 17 additions and 4 deletions

View File

@@ -1720,6 +1720,11 @@ table {
}
}
.in-favor,
.against {
display: inline;
}
.in-favor button {
@include like-unlike-icon(thumbs-up, $like);
}

View File

@@ -2,17 +2,17 @@
<%= t("comments.comment.votes", count: comment.total_votes) %>
&nbsp;|&nbsp;
<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>

View File

@@ -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")