Skip to content

Commit

Permalink
EL-1731: U18 Results screen for certificated checks (#1539)
Browse files Browse the repository at this point in the history
- fix bug that has been identified
- add more tests for other scenarios
- add test and logic so that this handles the changing answers from immigration to U18
  • Loading branch information
MazOneTwoOne authored Sep 19, 2024
1 parent a0874db commit d8b34de
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/services/check_answers/sections/case_details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def initialize(check)
def subsections
tables = [level_of_help_table]
if @check.under_eighteen?
tables += [aggregated_means_table] unless @check.controlled_clr?
tables += [aggregated_means_table] unless @check.controlled_clr? || !@check.controlled?
tables += [immigration_or_asylum_table] if @check.under_eighteen_assets? || @check.under_eighteen_regular_income? || @check.aggregated_means?
tables += [immigration_or_asylum_type_table, asylum_support_table] if @check.immigration_or_asylum? && !@check.controlled_clr?
tables += [immigration_or_asylum_type_table, asylum_support_table] if @check.immigration_or_asylum && !@check.controlled_clr?
else
tables += if @check.controlled?
[immigration_or_asylum_table]
Expand Down
58 changes: 52 additions & 6 deletions spec/flows/under_eighteen_flow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,60 @@
end
end

it "exits early for certificated work" do
fill_in_client_age_screen(choice: "Under 18")
fill_in_level_of_help_screen(choice: "Civil certificated")
confirm_screen(:check_answers)
expect(page).not_to have_content clr_text
context "when starting with over 18 controlled check that is an immigration matter type, change answer to under 18" do
before do
fill_in_client_age_screen(choice: "18 to 59")
fill_in_level_of_help_screen(choice: "Civil controlled work or family mediation")
fill_in_immigration_or_asylum_screen(choice: "Yes")
fill_in_immigration_or_asylum_type_screen(choice: "Immigration - controlled legal representation (CLR) in the First-tier Tribunal")
fill_in_asylum_support_screen
fill_in_forms_until(:check_answers)
within "#table-client_age" do
click_on "Change"
end
fill_in_client_age_screen(choice: "Under 18")
fill_in_under_18_controlled_legal_rep_screen(choice: "No")
fill_in_aggregated_means_screen(choice: "No")
fill_in_regular_income_screen(choice: "No")
fill_in_under_eighteen_assets_screen(choice: "No")
confirm_screen("check_answers")
end

it "shows correct sections" do
expect(all(".govuk-summary-card__title").map(&:text))
.to eq(
[
"Client age",
"Level of help",
"Means tests for under 18s",
],
)
end
end

context "when doing a certificated check" do
before do
fill_in_client_age_screen(choice: "Under 18")
fill_in_level_of_help_screen(choice: "Civil certificated")
end

it "hits check answers" do
confirm_screen(:check_answers)
expect(page).not_to have_content clr_text
end

it "shows correct sections" do
expect(all(".govuk-summary-card__title").map(&:text))
.to eq(
[
"Client age",
"Level of help",
],
)
end
end

it "exits early if means are aggregated certificated work" do
it "exits early if means are aggregated for controlled work" do
fill_in_client_age_screen(choice: "Under 18")
fill_in_level_of_help_screen(choice: "Civil controlled work or family mediation")
fill_in_under_18_controlled_legal_rep_screen(choice: "No")
Expand Down

0 comments on commit d8b34de

Please sign in to comment.