Browse Source

Pass question keys without the content to get the status

pull/28/head
Kat 4 years ago
parent
commit
92bf9f9b1d
  1. 2
      app/views/case_logs/_tasklist.html.erb
  2. 9
      spec/features/case_log_spec.rb

2
app/views/case_logs/_tasklist.html.erb

@ -11,7 +11,7 @@
<li class="app-task-list__item" id=<%= subsection_key %>> <li class="app-task-list__item" id=<%= subsection_key %>>
<% first_page = @form.first_page_for_subsection(subsection_key) %> <% first_page = @form.first_page_for_subsection(subsection_key) %>
<%= link_to subsection_value["label"], send("case_log_#{first_page}_path", @case_log), class: "task-name govuk-link" %> <%= link_to subsection_value["label"], send("case_log_#{first_page}_path", @case_log), class: "task-name govuk-link" %>
<% subsection_status=get_subsection_status(subsection_key, @case_log, @form.questions_for_subsection(subsection_key)) %> <% subsection_status=get_subsection_status(subsection_key, @case_log, @form.questions_for_subsection(subsection_key).keys) %>
<strong class="govuk-tag app-task-list__tag <%= get_status_style(subsection_status) %>"> <strong class="govuk-tag app-task-list__tag <%= get_status_style(subsection_status) %>">
<%= get_status_label(subsection_status) %> <%= get_status_label(subsection_status) %>
</strong> </strong>

9
spec/features/case_log_spec.rb

@ -52,6 +52,15 @@ RSpec.describe "Test Features" do
assert_selector ".govuk-tag", text: /Cannot start yet/, count: 1 assert_selector ".govuk-tag", text: /Cannot start yet/, count: 1
end end
it "shows the correct status if one section is completed" do
answer_all_questions_in_income_subsection
visit("/case_logs/#{empty_case_log.id}")
assert_selector ".govuk-tag", text: /Not started/, count: 7
assert_selector ".govuk-tag", text: /Completed/, count: 1
assert_selector ".govuk-tag", text: /Cannot start yet/, count: 1
end
it "skips to the first section if no answers are completed" do it "skips to the first section if no answers are completed" do
visit("/case_logs/#{empty_case_log.id}") visit("/case_logs/#{empty_case_log.id}")
expect(page).to have_link("Skip to next incomplete section", :href => /#household_characteristics/) expect(page).to have_link("Skip to next incomplete section", :href => /#household_characteristics/)

Loading…
Cancel
Save