Skip to content

Commit

Permalink
Merge pull request #1027 from alphagov/taxonomy-navigation-beta-message
Browse files Browse the repository at this point in the history
Show BETA phase message during AB test
  • Loading branch information
andrewgarner authored Aug 14, 2018
2 parents 22c66f4 + c38df47 commit a37faae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/helpers/phase_label_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
module PhaseLabelHelper
def render_phase_label(presented_object, message)
if presented_object.respond_to?(:phase) && %w(alpha beta).include?(presented_object.phase)
if show_new_navigation?
beta_message = <<~BETA_MESSAGE.html_safe
This is a test version of the layout of this page.
<a id=taxonomy-navigation-survey
href='https://www.smartsurvey.co.uk/s/navigationsurvey2018?c=#{current_path_without_query_string}'
target='_blank'
rel='noopener noreferrer'>Take the survey to help us improve it</a>
BETA_MESSAGE

render 'govuk_publishing_components/components/phase_banner', phase: 'beta', message: beta_message

elsif presented_object.respond_to?(:phase) && %w(alpha beta).include?(presented_object.phase)
locals = {}
locals[:message] = message if message.present?

Expand Down
16 changes: 16 additions & 0 deletions test/integration/content_pages_navigation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,22 @@ class ContentPagesNavigationTest < ActionDispatch::IntegrationTest
end
end

test "ContentPagesNav variant B shows BETA phase message and survey link" do
stub_rummager
setup_variant_b

setup_and_visit_content_item_with_taxons('guide', SINGLE_TAXON)

within('.gem-c-phase-banner') do
assert page.has_css?('.phase-tag', text: 'BETA')

assert page.has_content?('This is a test version of the layout of this page.')

assert page.has_css?('a[href="https://www.smartsurvey.co.uk/s/navigationsurvey2018?c=/national-curriculum"]',
text: 'Take the survey to help us improve it')
end
end

def stub_empty_services
Supergroups::Services.any_instance.stubs(:all_services).returns({})
end
Expand Down

0 comments on commit a37faae

Please sign in to comment.