Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAPT-1729] Use GOVUK formbuilder for mobile number form #2866

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 16 additions & 26 deletions app/views/claims/mobile_number.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,25 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= render("shared/error_summary", instance: @form) if @form.errors.any? %>
<%= form_for @form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_error_summary %>

<%= form_for @form, url: claim_path(current_journey_routing_name) do |f| %>
<span class="govuk-caption-xl"><%= t("questions.personal_details") %></span>
<%= form_group_tag f.object do %>
<h1 class="govuk-label-wrapper">
<%= f.label(
:mobile_number,
t("questions.mobile_number"),
class: "govuk-label #{label_css_class_for_journey(f.object.journey)}"
) %>
</h1>
<%= f.govuk_phone_field :mobile_number,
spellcheck: "false",
caption: {
text: t("questions.personal_details"),
size: "xl"
},
label: {
text: t("questions.mobile_number"),
tag: "h1",
size: "xl",
},
hint: { text: "To verify your mobile number we will send you a text message with a 6-digit passcode. You can enter the passcode on the next screen." } %>

<div id="mobile-number-hint" class="govuk-hint">
To verify your mobile number we will send you a text message with a 6-digit passcode. You can enter the passcode on the next screen.
</div>

<%= errors_tag f.object, :mobile_number %>

<%= f.text_field(
:mobile_number,
spellcheck: "false",
class: css_classes_for_input(f.object, :mobile_number),
"aria-describedby" => "mobile-number-hint"
) %>

<% end %>
<%= render "help_with_access_codes", communication_type: "Mobile" %>
<%= f.submit "Continue", class: "govuk-button" %>

<%= f.govuk_submit "Continue" %>
<% end %>
</div>
</div>
2 changes: 1 addition & 1 deletion spec/features/changing_answers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@
expect(page).not_to have_content("Check your answers before sending your application")
expect(page).to have_text(I18n.t("questions.mobile_number"))

fill_in "claim_mobile_number", with: new_mobile
fill_in "Mobile number", with: new_mobile
click_on "Continue"

expect(session.reload.answers.mobile_number).to eql new_mobile
Expand Down
2 changes: 1 addition & 1 deletion spec/features/claim_with_mobile_sms_otp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# - Mobile number
expect(page).to have_text(I18n.t("questions.mobile_number"))

fill_in "claim_mobile_number", with: scenario[:mobile_number]
fill_in "Mobile number", with: scenario[:mobile_number]
click_on "Continue"

expect(session.reload.answers.mobile_number).to eql(scenario[:mobile_number])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def provide_alternative_number
find("#claim_mobile_check_alternative").click
click_on "Continue"

fill_in "claim_mobile_number", with: alt_phone_number
fill_in "Mobile number", with: alt_phone_number
click_on "Continue"

fill_in "claim_one_time_password", with: otp_code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def provide_alternative_number
find("#claim_mobile_check_alternative").click
click_on "Continue"

fill_in "claim_mobile_number", with: alt_phone_number
fill_in "Mobile number", with: alt_phone_number
click_on "Continue"

fill_in "claim_one_time_password", with: otp_code
Expand Down