Skip to content

Commit

Permalink
Merge pull request #3129 from alphagov/set-up-user-research-banner
Browse files Browse the repository at this point in the history
Set up DWP user research banner
  • Loading branch information
beccapearce authored Mar 20, 2024
2 parents f2ec867 + 46e78b2 commit 4422bc8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class ContentItemsController < ApplicationController
include GovukPersonalisation::ControllerConcern
include RecruitmentBannerHelper
include Slimmer::Headers
include Slimmer::Template

Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<% end %>
<% end %>

<%= render partial: 'shared/intervention_banner' %>

<%= yield :header %>

<main role="main" id="content" class="<%= @content_item.schema_name.dasherize %>" lang="<%= I18n.locale %>">
Expand Down
9 changes: 9 additions & 0 deletions lib/data/recruitment_banners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@
# - /foreign-travel-advice

banners:
- name: DWP user research banner
suggestion_text: Help improve GOV.UK
suggestion_link_text: Take part in user research (opens in a new tab)
survey_url: https://forms.office.com/e/CkfCRwdLQj
page_paths:
- /maternity-allowance
- /funeral-payments
- /disability-living-allowance-children
- /pension-credit
34 changes: 34 additions & 0 deletions test/integration/recruitment_banner_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require "test_helper"

class RecruitmentBannerTest < ActionDispatch::IntegrationTest
test "Brand user research banner is displayed on pages of interest" do
guide = GovukSchemas::Example.find("guide", example_name: "guide")

pages_of_interest =
[
"/maternity-allowance",
"/funeral-payments",
"/disability-living-allowance-children",
"/pension-credit",
]

pages_of_interest.each do |path|
guide["base_path"] = path
stub_content_store_has_item(guide["base_path"], guide.to_json)
visit guide["base_path"]

assert page.has_css?(".gem-c-intervention")
assert page.has_link?("Take part in user research", href: "https://forms.office.com/e/CkfCRwdLQj")
end
end

test "Brand user research banner is not displayed on all pages" do
guide = GovukSchemas::Example.find("guide", example_name: "guide")
guide["base_path"] = "/nothing-to-see-here"
stub_content_store_has_item(guide["base_path"], guide.to_json)
visit guide["base_path"]

assert_not page.has_css?(".gem-c-intervention")
assert_not page.has_link?("Take part in user research", href: "https://forms.office.com/e/CkfCRwdLQj")
end
end

0 comments on commit 4422bc8

Please sign in to comment.