Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default Exit This Page button text #3989

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ params:
- name: text
type: string
required: false
description: Text for the link. If `html` is provided, the `text` option will be ignored. Defaults to 'Exit this page'.
description: Text for the link. If `html` is provided, the `text` option will be ignored. Defaults to 'Emergency Exit this page' with 'Emergency' visually hidden.
querkmachine marked this conversation as resolved.
Show resolved Hide resolved
- name: html
type: string
required: false
description: HTML for the link. If `html` is provided, the `text` option will be ignored.
description: HTML for the link. If `html` is provided, the `text` option will be ignored. Defaults to 'Emergency Exit this page' with 'Emergency' visually hidden.
- name: redirectUrl
type: string
required: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{% from "../button/macro.njk" import govukButton -%}

{% set defaultHtml -%}
<span class="govuk-visually-hidden">Emergency</span> Exit this page
{%- endset -%}

<div
{%- if params.id %} id="{{ params.id }}"{% endif %} class="govuk-exit-this-page {%- if params.classes %} {{ params.classes }}{% endif %}" data-module="govuk-exit-this-page" {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}
{%- if params.activatedText %} data-i18n.activated="{{ params.activatedText | escape }}"{% endif %}
Expand All @@ -8,8 +12,8 @@
{%- if params.pressOneMoreTimeText %} data-i18n.press-one-more-time="{{ params.pressOneMoreTimeText | escape }}"{% endif %}
>
{{- govukButton({
html: params.html,
text: params.text | default("Exit this page"),
html: params.html if (params.html or params.text) else defaultHtml,
text: params.text,
classes: "govuk-button--warning govuk-exit-this-page__button govuk-js-exit-this-page-button",
href: params.redirectUrl | default("https://www.bbc.co.uk/weather")
}) -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Exit this page', () => {
const $button = $('.govuk-exit-this-page').find('.govuk-button')

expect($button.hasClass('govuk-button--warning')).toBeTruthy()
expect($button.text()).toContain('Exit this page')
expect($button.html()).toContain('<span class="govuk-visually-hidden">Emergency</span> Exit this page')
expect($button.attr('href')).toBe('/full-page-examples/announcements')
})
})
Expand Down