-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make feedback banner use the configuration in the locale file
The feedback banner has a locale configuration value, but we had stopped using it at some point in favour of a variable in the phase banner template file. This came as a bit of a surprise, resulting in the feedback banner being live unexpectedly.
- Loading branch information
Showing
4 changed files
with
39 additions
and
29 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
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
require "test_helper" | ||
|
||
class PhaseBannerTest < ActionDispatch::IntegrationTest | ||
test "uses the show_banner value in the whats_new.yml file to determine whether to render the whats new banner" do | ||
login_as create(:gds_editor) | ||
get admin_root_path | ||
|
||
if I18n.t("admin.whats_new.show_banner") | ||
assert_select "#whats_new_banner .govuk-phase-banner__content__tag", text: "What's new" | ||
else | ||
assert_select "#whats_new_banner.gem-c-phase-banner", count: 0 | ||
end | ||
end | ||
|
||
test "uses the show_banner value in the whats_new.yml file to determine whether to render the feedback banner" do | ||
login_as create(:gds_editor) | ||
get admin_root_path | ||
|
||
if I18n.t("admin.feedback.show_banner") | ||
assert_select "#feedback_banner .govuk-phase-banner__content__tag", text: "Feedback" | ||
else | ||
assert_select "#feedback_banner", count: 0 | ||
end | ||
end | ||
|
||
test "uses the configuration value in the maintenance_banner.yml locale file to determine whether to render the banner" do | ||
login_as create(:gds_editor) | ||
get admin_root_path | ||
|
||
if I18n.t("admin.maintenance_banner.show_banner") | ||
assert_select "#maintenance_banner .govuk-phase-banner__content__tag", text: "Maintenance" | ||
assert_select "#maintenance_banner .govuk-phase-banner__text", text: I18n.t("admin.maintenance_banner.message") | ||
else | ||
assert_select "#maintenance_banner", count: 0 | ||
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