Fix link to debates help
This link used to open in a new window, and we accidentally changed that
behavior while refactoring it in commit c2710de5f.
Since we're adding a test for this case, and the Proposals::NewComponent
class is similar, we're adding a test for that class too. In the case of
proposals, we need to sign in a user because the proposals form contains
fields to attach image, that currently rely on a user being signed in.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<%= back_link_to debates_path, t("debates.index.section_header.title") %>
|
<%= back_link_to debates_path, t("debates.index.section_header.title") %>
|
||||||
|
|
||||||
<%= header do %>
|
<%= header do %>
|
||||||
<%= link_to t("debates.new.more_info"), help_path(anchor: "debates") %>
|
<%= new_window_link_to t("debates.new.more_info"), help_path(anchor: "debates") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<aside>
|
<aside>
|
||||||
|
|||||||
15
spec/components/debates/new_component_spec.rb
Normal file
15
spec/components/debates/new_component_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Debates::NewComponent do
|
||||||
|
let(:debate) { build(:debate) }
|
||||||
|
|
||||||
|
describe "header" do
|
||||||
|
it "contains a link to open the help page in a new window" do
|
||||||
|
render_inline Debates::NewComponent.new(debate)
|
||||||
|
|
||||||
|
page.find("header") do |header|
|
||||||
|
expect(header).to have_css "a[target=_blank]", exact_text: "How do debates work?"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
16
spec/components/proposals/new_component_spec.rb
Normal file
16
spec/components/proposals/new_component_spec.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Proposals::NewComponent do
|
||||||
|
before { sign_in(create(:user)) }
|
||||||
|
let(:proposal) { build(:proposal) }
|
||||||
|
|
||||||
|
describe "header" do
|
||||||
|
it "contains a link to open the help page in a new window" do
|
||||||
|
render_inline Proposals::NewComponent.new(proposal)
|
||||||
|
|
||||||
|
page.find("header") do |header|
|
||||||
|
expect(header).to have_css "a[target=_blank]", exact_text: "How do citizen proposals work?"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user