Skip to content

Commit

Permalink
AP-5592: Update scope limits on check provider answers
Browse files Browse the repository at this point in the history
>[!IMPORTANT]
>Set up a feature test for expected current behaviour
>
>This changes the proceeding_details partial IDs quite heavily
to make testing easier.  Running first to see if it affects
multiple tests
  • Loading branch information
colinbruce committed Dec 17, 2024
1 parent 691ec50 commit 8d16c6f
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/check-your-answers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@
.print-no-break>.govuk-body {
word-wrap: break-word;
}

.single-scope-limit-bold-heading {
font-weight: bold;
}
20 changes: 17 additions & 3 deletions app/views/shared/check_answers/_proceeding_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end
end

card.with_summary_list(actions: false) do |summary_list|
card.with_summary_list(actions: false, html_attributes: { id: "#{proceeding.ccms_code.downcase}-questions" }) do |summary_list|
summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.name}_client_involvement_type" }) do |row|
row.with_key(text: t(".client_involvement_type_details.question"), classes: "govuk-!-width-one-third")
row.with_value { proceeding.client_involvement_type_description }
Expand All @@ -34,10 +34,17 @@
end
end

summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.name}_emergency_scope_limitations_#{proceeding.id}" }) do |row|
summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.ccms_code.downcase}_emergency_scope_limitations" }) do |row|
row.with_key(text: t(".scope_limits.emergency.question"))
row.with_value { scope_limits(proceeding, "emergency") }
end

# if one_scope_limit_with_hearing_date(proceeding, :emergency)
# summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.name}_emergency_scope_limitations_hearing_date" }) do |row|
# row.with_key(text: t(".scope_limits.hearing_date"))
# row.with_value { one_scope_limit_with_hearing_date(proceeding, :emergency) }
# end
# end
end

summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.name}_substantive_level_of_service_#{proceeding.id}" }) do |row|
Expand All @@ -54,10 +61,17 @@
end
end

summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.name}_substantive_scope_limitations_#{proceeding.id}" }) do |row|
summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.ccms_code.downcase}_substantive_scope_limitations" }) do |row|
row.with_key(text: t(".scope_limits.substantive.question"))
row.with_value { scope_limits(proceeding, "substantive") }
end

# if one_scope_limit_with_a_hearing_date(proceeding, :substantive)
# summary_list.with_row(html_attributes: { id: "app-check-your-answers__#{proceeding.name}_emergency_scope_limitations_hearing_date_#{proceeding.id}" }) do |row|
# row.with_key(text: t(".scope_limits.hearing_date"))
# row.with_value { one_scope_limit_with_hearing_date(proceeding, :substantive).strftime("%-d %B %Y") }
# end
# end
end
end %>
<% end %>
Expand Down
24 changes: 24 additions & 0 deletions features/providers/check_provider_answers.feature
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,27 @@ Feature: Checking client details answers backwards and forwards
When I choose "No"
And I click "Save and continue"
Then I should be on a page showing 'Check your answers'

@javascript @vcr
Scenario: Multiple scope limitations are displayed as expected
Given I have created an application with da004 proceedings with delegated functions
And I view the check provider answers page

Then the following sections should exist:
| tag | section |
| h2 | Client details |
| h2 | Proceedings |
| h2 | Non-molestation order |
| h2 | What happens next |

And the "da004" proceeding check your answers section should contain:
| question | answer |
| Client role | Applicant/Claimant/Petitioner |
| Delegated functions | *skip-calculated* |
| Emergency level of service | Full Representation |
| Emergency scope limitations | Interim order inc. return date\nLimited to Family Help (Higher) and to all steps necessary to negotiate and conclude a settlement. To include the issue of proceedings and representation in those proceedings save in relation to or at a contested final hearing. |
| Substantive level of service | Full Representation |
| Substantive scope limitations | Final hearing\nLimited to all steps up to and including final hearing and any action necessary to implement (but not enforce) the order. |

And the emergency scope limitation Interim order inc. return date heading for da004 should not be bold
And the substantive scope limitation Final hearing heading for da004 should not be bold
56 changes: 56 additions & 0 deletions features/step_definitions/check_provider_answers_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,59 @@
Then("the \"Partner details\" check your answers section should contain:") do |table|
expect_questions_and_answers_in(selector: "#partner-details-questions", expected: table)
end

Given(/^I have created an application with (.*) proceedings (with|without) delegated functions$/) do |proceedings, df|
proceeding_array = proceedings.split(",").map(&:to_sym)
df_options = df == "with" ? proceeding_array.map { |p| { p.upcase => [10.days.ago, 10.days.ago] } }[0] : {}
applicant = create(
:applicant,
first_name: "Test",
last_name: "Test",
national_insurance_number: "JA123456A",
date_of_birth: "01-01-1970",
email: "[email protected]",
has_partner: false,
)
create(
:address,
address_line_one: "Transport For London",
address_line_two: "98 Petty France",
city: "London",
postcode: "SW1H 9EA",
lookup_used: true,
applicant:,
)
@legal_aid_application = create(
:legal_aid_application,
:with_non_passported_state_machine,
:at_entering_applicant_details,
:with_proceedings,
:with_delegated_functions_on_proceedings,
explicit_proceedings: proceeding_array,
set_lead_proceeding: proceeding_array.first,
df_options:,
applicant:,
)
login_as @legal_aid_application.provider
end

And("I view the check provider answers page") do
visit(providers_legal_aid_application_check_provider_answers_path(@legal_aid_application))
steps %(Then I should be on a page showing 'Check your answers')
end

Then("the {string} proceeding check your answers section should contain:") do |proceeding_code, table|
expect_questions_and_answers_in(selector: "##{proceeding_code}-questions", expected: table)
end

Then(/^the (emergency|substantive) scope limitation (.*) heading for (.*) should (be|not be) bold$/) do |type, text, proceeding_code, match|
within("##{proceeding_code}-questions") do
within("#app-check-your-answers__#{proceeding_code}_#{type}_scope_limitations") do
if match == "be"
expect(page).to have_css("span.single-scope-limit-heading", text:, visible: :visible)
else
expect(page).to have_no_css("span.single-scope-limit-heading", text:)
end
end
end
end
4 changes: 2 additions & 2 deletions features/step_definitions/generic_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def expect_questions_in(expected:, selector:, negate: false)
def expect_questions_and_answers_in(expected:, selector:)
within(selector) do
expected.hashes.each do |row|
expect(page).to have_css("dt", text: row[:question]), "expected to find tag \"dt\" with text: \"#{row[:question]}\""
expect(page).to have_css("dd", text: row[:answer]), "expected to find tag \"dd\" with text: \"#{row[:answer]}\""
expect(page).to have_css("dt", text: row[:question]), "expected to find tag \"dt\" with text: \"#{row[:question]}\"" unless row[:question] == "*skip-calculated*"
expect(page).to have_css("dd", text: row[:answer]), "expected to find tag \"dd\" with text: \"#{row[:answer]}\"" unless row[:answer] == "*skip-calculated*"
end
end
end
Expand Down

0 comments on commit 8d16c6f

Please sign in to comment.