-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2704 from alphagov/add-col-banners
Add Cost of living survey banner
- Loading branch information
Showing
5 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,7 @@ | |
max-width: 30em; | ||
padding-top: govuk-spacing(2); | ||
} | ||
|
||
.gem-c-intervention { | ||
margin-top: govuk-spacing(4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module ContentItem | ||
module CostOfLivingBanner | ||
COST_OF_LIVING_SURVEY_URL = "https://surveys.publishing.service.gov.uk/s/XS2YWV/".freeze | ||
|
||
SURVEY_URL_MAPPINGS = { | ||
"/guidance/cost-of-living-payment" => COST_OF_LIVING_SURVEY_URL, | ||
"/cost-living-help-local-council" => COST_OF_LIVING_SURVEY_URL, | ||
"/benefits-calculators" => COST_OF_LIVING_SURVEY_URL, | ||
"/the-warm-home-discount-scheme" => COST_OF_LIVING_SURVEY_URL, | ||
"/universal-credit" => COST_OF_LIVING_SURVEY_URL, | ||
"/universal-credit/eligibility" => COST_OF_LIVING_SURVEY_URL, | ||
"/universal-credit/what-youll-get" => COST_OF_LIVING_SURVEY_URL, | ||
"/universal-credit/how-to-claim" => COST_OF_LIVING_SURVEY_URL, | ||
"/universal-credit/other-financial-support" => COST_OF_LIVING_SURVEY_URL, | ||
"/universal-credit/contact-universal-credit" => COST_OF_LIVING_SURVEY_URL, | ||
"/new-state-pension/what-youll-get" => COST_OF_LIVING_SURVEY_URL, | ||
"/get-help-energy-bills" => COST_OF_LIVING_SURVEY_URL, | ||
"/get-help-energy-bills/getting-discount-energy-bill" => COST_OF_LIVING_SURVEY_URL, | ||
"/pension-credit" => COST_OF_LIVING_SURVEY_URL, | ||
}.freeze | ||
|
||
def survey_url | ||
cost_of_living_test_url | ||
end | ||
|
||
def cost_of_living_test_url | ||
key = content_item["base_path"] | ||
SURVEY_URL_MAPPINGS[key] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require "test_helper" | ||
|
||
class RecruitmentBannerTest < ActionDispatch::IntegrationTest | ||
test "Cost of living survey banner is displayed on pages of interest" do | ||
guide = GovukSchemas::Example.find("guide", example_name: "guide") | ||
|
||
pages_of_interest = %w[ | ||
/guidance/cost-of-living-payment | ||
/cost-living-help-local-council | ||
/benefits-calculators | ||
/the-warm-home-discount-scheme | ||
/universal-credit | ||
/universal-credit/eligibility | ||
/universal-credit/what-youll-get | ||
/universal-credit/how-to-claim | ||
/universal-credit/other-financial-support | ||
/universal-credit/contact-universal-credit | ||
/new-state-pension/what-youll-get | ||
/get-help-energy-bills | ||
/get-help-energy-bills/getting-discount-energy-bill | ||
/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 (opens in a new tab)", href: "https://surveys.publishing.service.gov.uk/s/XS2YWV/") | ||
end | ||
end | ||
|
||
test "Cost of living recruitment 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 (opens in a new tab)", href: "https://surveys.publishing.service.gov.uk/s/XS2YWV/") | ||
end | ||
end |