Add attribute anchor to link

Anchor needs to be added to the link to redirect directly to the comments section.
This commit is contained in:
taitus
2022-08-16 13:29:40 +02:00
parent af00dd94db
commit 9f90125fa7
2 changed files with 11 additions and 1 deletions

View File

@@ -8,7 +8,7 @@
<div class="debate-meta">
<%= render Shared::CommentsCountComponent.new(
question.comments.count,
url: legislation_process_question_path(question.process, question)
url: legislation_process_question_path(question.process, question, anchor: "comments")
) %>
· <span class="debate-date"><%= l question.created_at.to_date %></span>
</div>

View File

@@ -109,5 +109,15 @@ describe "Legislation" do
expect(page).not_to have_selector(:link_or_button, "Submit answer")
end
scenario "render link to questions comments with anchor" do
question = create(:legislation_question, process: process, title: "Question without comments")
visit legislation_process_path(process)
expect(page).to have_link "No comments", href: legislation_process_question_path(process,
question,
anchor: "comments")
end
end
end