diff --git a/Gemfile b/Gemfile index 492278eab..f28f6dee0 100644 --- a/Gemfile +++ b/Gemfile @@ -29,7 +29,7 @@ group :development, :test do gem "dotenv-rails" gem "factory_bot_rails" gem "pry-byebug" - # gem "selenium-webdriver", require: false + gem "selenium-webdriver", require: false gem "simplecov", require: false %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib| gem lib, git: "https://github.com/rspec/#{lib}.git", branch: "main", require: false diff --git a/Gemfile.lock b/Gemfile.lock index d09c26ade..1e4ad2c71 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -147,7 +147,7 @@ GEM activemodel (>= 6.0) railties (>= 6.0) view_component (~> 2.39.0) - govuk_design_system_formbuilder (2.7.4) + govuk_design_system_formbuilder (2.7.5) actionview (>= 6.0) activemodel (>= 6.0) activesupport (>= 6.0) @@ -267,6 +267,7 @@ GEM rubocop (~> 1.0) rubocop-ast (>= 1.1.0) ruby-progressbar (1.11.0) + rubyzip (2.3.2) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -276,6 +277,9 @@ GEM sass (~> 3.5, >= 3.5.5) scss_lint-govuk (0.2.0) scss_lint + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) semantic_range (3.0.0) simplecov (0.21.2) docile (~> 1.1) @@ -349,6 +353,7 @@ DEPENDENCIES rubocop-performance rubocop-rails scss_lint-govuk + selenium-webdriver simplecov tzinfo-data web-console (>= 4.1.0) diff --git a/app/helpers/conditional_questions_helper.rb b/app/helpers/conditional_questions_helper.rb new file mode 100644 index 000000000..8967207f4 --- /dev/null +++ b/app/helpers/conditional_questions_helper.rb @@ -0,0 +1,15 @@ +module ConditionalQuestionsHelper + def conditional_questions_for_page(page) + page["questions"].values.map { |question| + question["conditional_for"] + }.compact.map(&:keys).flatten + end + + def display_question_key_div(page_info, question_key) + if conditional_questions_for_page(page_info).include?(question_key) + "