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:
@@ -8,7 +8,7 @@
|
|||||||
<div class="debate-meta">
|
<div class="debate-meta">
|
||||||
<%= render Shared::CommentsCountComponent.new(
|
<%= render Shared::CommentsCountComponent.new(
|
||||||
question.comments.count,
|
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>
|
· <span class="debate-date"><%= l question.created_at.to_date %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -109,5 +109,15 @@ describe "Legislation" do
|
|||||||
|
|
||||||
expect(page).not_to have_selector(:link_or_button, "Submit answer")
|
expect(page).not_to have_selector(:link_or_button, "Submit answer")
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user