diff --git a/Gemfile b/Gemfile index f28f6dee0..67b62e4ba 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem "jbuilder", "~> 2.7" gem "bootsnap", ">= 1.4.4", require: false # Gov.UK frontend components gem "govuk-components" -gem "govuk_design_system_formbuilder" +gem "govuk_design_system_formbuilder", git: "https://github.com/DFE-Digital/govuk-formbuilder.git", branch: "whitelist-mergeable-html-attributes" gem "hotwire-rails" group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 11eff1ccd..4305e278d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,14 @@ +GIT + remote: https://github.com/DFE-Digital/govuk-formbuilder.git + revision: 353af59081f0d53cc30d7d91cf86e03dd3cbd1f0 + branch: whitelist-mergeable-html-attributes + specs: + govuk_design_system_formbuilder (2.7.4) + actionview (>= 6.0) + activemodel (>= 6.0) + activesupport (>= 6.0) + deep_merge (~> 1.2.1) + GIT remote: https://github.com/rspec/rspec-core.git revision: 053fcfeb6b0b6627edf7261737553a6f7df8cc14 @@ -147,11 +158,6 @@ GEM activemodel (>= 6.0) railties (>= 6.0) view_component (~> 2.39.0) - govuk_design_system_formbuilder (2.7.4) - actionview (>= 6.0) - activemodel (>= 6.0) - activesupport (>= 6.0) - deep_merge (~> 1.2.1) hotwire-rails (0.1.3) rails (>= 6.0.0) stimulus-rails @@ -175,6 +181,8 @@ GEM minitest (5.14.4) msgpack (1.4.2) nio4r (2.5.8) + nokogiri (1.12.4-x86_64-darwin) + racc (~> 1.4) nokogiri (1.12.4-x86_64-linux) racc (~> 1.4) overcommit (0.58.0) @@ -332,7 +340,7 @@ DEPENDENCIES dotenv-rails factory_bot_rails govuk-components - govuk_design_system_formbuilder + govuk_design_system_formbuilder! hotwire-rails jbuilder (~> 2.7) listen (~> 3.3) diff --git a/app/views/form/_radio_question.html.erb b/app/views/form/_radio_question.html.erb index 82218b2a2..1805a2d68 100644 --- a/app/views/form/_radio_question.html.erb +++ b/app/views/form/_radio_question.html.erb @@ -7,7 +7,7 @@ <% if key.starts_with?("divider") %> <%= f.govuk_radio_divider %> <% elsif question["conditional_for"] %> - <%= f.govuk_radio_button question_key, key, label: { text: val }, + <%= f.govuk_radio_button question_key, val, label: { text: val }, "data-controller": "conditional-question", "data-action": "click->conditional-question#displayConditional", "data-info": question["conditional_for"].to_json diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 8815212d3..ee64f40b0 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -294,8 +294,8 @@ "3": "Prefer not to say" }, "conditional_for": { - "armed_forces_active": ["0", "1"], - "armed_forces_injured": ["0", "1"] + "armed_forces_active": ["Yes - a regular", "Yes - a reserve"], + "armed_forces_injured": ["Yes - a regular", "Yes - a reserve"] } }, "armed_forces_active": { diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index 4b7a650c8..9f8d6dfad 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -229,14 +229,14 @@ RSpec.describe "Test Features" do it "shows conditional questions if the required answer is selected and hides it again when a different answer option is selected", js: true do visit("/case_logs/#{id}/armed_forces") # Someting about our styling makes the selenium webdriver think the actual radio buttons are not visible so we allow label click here - choose("armed-forces-0-field", allow_label_click: true) + choose("armed-forces-yes-a-regular-field", allow_label_click: true) expect(page).to have_selector("#armed_forces_injured_div") - choose("armed-forces-injured-1-field", allow_label_click: true) - expect(find_field("armed-forces-injured-1-field", visible: false).checked?).to be_truthy - choose("armed-forces-2-field", allow_label_click: true) + choose("armed-forces-injured-no-field", allow_label_click: true) + expect(find_field("armed-forces-injured-no-field", visible: false).checked?).to be_truthy + choose("armed-forces-no-field", allow_label_click: true) expect(page).not_to have_selector("#armed_forces_injured_div") - choose("armed-forces-0-field", allow_label_click: true) - expect(find_field("armed-forces-injured-1-field", visible: false).checked?).to be_falsey + choose("armed-forces-yes-a-regular-field", allow_label_click: true) + expect(find_field("armed-forces-injured-no-field", visible: false).checked?).to be_falsey end end end