Skip to content

Commit

Permalink
Merge pull request #1822 from alphagov/update-global-banner
Browse files Browse the repository at this point in the history
Add exception to global banner
  • Loading branch information
brucebolt authored Aug 29, 2019
2 parents 8b64ec5 + 9d2f17a commit d723789
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/views/notifications/_global_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<% if show_global_bar %>
<% content_for :head do %>
<!--[if gt IE 7]><!-->
<script>!function(t){"use strict";function e(){return!/^\/register-to-vote|^\/done/.test(window.location.pathname)}function n(){var e=t.cookie.match("(?:^|[ ;])global_bar_seen=([0-9]+)");return e?parseInt(e.pop(),10)<3:!0}var o=t.documentElement;e()&&n()&&(o.className=o.className.concat(" show-global-bar"))}(document);</script>
<script>!function(t){"use strict";function e(){return!/^\/register-to-vote|^\/done|^\/brexit|^\/get-ready-brexit-check/.test(window.location.pathname)}function n(){var e=t.cookie.match("(?:^|[ ;])global_bar_seen=([0-9]+)");return e?parseInt(e.pop(),10)<3:!0}var o=t.documentElement;e()&&n()&&(o.className=o.className.concat(" show-global-bar"))}(document);</script>
<!--<![endif]-->
<% end %>
<!--[if gt IE 7]><!-->
Expand Down
14 changes: 12 additions & 2 deletions spec/javascripts/global-bar-class-toggle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("toggling a global bar HTML class based on cookie", function () {
}

function urlPermitsShow() {
return !/^\/register-to-vote|^\/done/.test(window.location.pathname);
return !/^\/register-to-vote|^\/done|^\/brexit|^\/get-ready-brexit-check/.test(window.location.pathname);
}

function viewCountPermitsShow() {
Expand All @@ -48,7 +48,7 @@ describe("toggling a global bar HTML class based on cookie", function () {
var window = fakeWindow || root;

/* begin minify */
!function(t){"use strict";function e(){return!/^\/register-to-vote|^\/done/.test(window.location.pathname)}function n(){var e=t.cookie.match("(?:^|[ ;])global_bar_seen=([0-9]+)");return e?parseInt(e.pop(),10)<3:!0}var o=t.documentElement;e()&&n()&&(o.className=o.className.concat(" show-global-bar"))}(document);
!function(t){"use strict";function e(){return!/^\/register-to-vote|^\/done|^\/brexit|^\/get-ready-brexit-check/.test(window.location.pathname)}function n(){var e=t.cookie.match("(?:^|[ ;])global_bar_seen=([0-9]+)");return e?parseInt(e.pop(),10)<3:!0}var o=t.documentElement;e()&&n()&&(o.className=o.className.concat(" show-global-bar"))}(document);
/* end minify */
}

Expand Down Expand Up @@ -121,6 +121,16 @@ describe("toggling a global bar HTML class based on cookie", function () {
globalBarFn({location: {pathname: '/done'}});
expectGlobalBarToBeHidden();
});

it("does not show on brexit landing page", function() {
globalBarFn({location: {pathname: '/brexit'}});
expectGlobalBarToBeHidden();
});

it("does not show on brexit checker pages", function() {
globalBarFn({location: {pathname: '/get-ready-brexit-check'}});
expectGlobalBarToBeHidden();
});
}

function expectGlobalBarToShow() {
Expand Down

0 comments on commit d723789

Please sign in to comment.