Browse Source

back link tests added

pull/21/head
Matthew Phelan 3 years ago
parent
commit
88dcdb326f
  1. 6
      app/views/form/questions/tenant_code.html.erb
  2. 14
      spec/features/case_log_spec.rb

6
app/views/form/questions/tenant_code.html.erb

@ -1,9 +1,5 @@
<% previous_question = Form.previous_question("tenant_code") %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %>
Back
<% end %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= turbo_frame_tag "case_log_form", target: "_top" do %>
<%= render GovukComponent::BackLinkComponent.new(href: "/case_logs/#{case_log_id}", text: 'Back') do %><% end %>
<%= form_with action: '/case_logs', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> <%= form_with action: '/case_logs', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_text_field :tenant_code, <%= f.govuk_text_field :tenant_code,
hint: { text: "More detail" }, hint: { text: "More detail" },

14
spec/features/case_log_spec.rb

@ -39,4 +39,18 @@ RSpec.describe "Test Features" do
end end
end end
end end
describe "Back link directs correctly" do
it "go back to tasklist page from tenant code" do
visit("/case_logs/#{id}/tenant_code")
click_link(text: 'Back')
expect(page).to have_content("Tasklist for log #{id}")
end
it "go back to tenant code page from tenant age page" do
visit("/case_logs/#{id}/tenant_age")
click_link(text: 'Back')
expect(page).to have_field("tenant-code-field")
end
end
end end

Loading…
Cancel
Save