@defra/lis-infra-ui-services 0.28.0 → 0.29.0-lreg-665.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -85,6 +85,34 @@ describe('error pages', () => {
|
|
|
85
85
|
expect(html).not.toContain('Sign in')
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
+
test('not authorised offers a sign out button when signOutHref is given', () => {
|
|
89
|
+
// Arrange
|
|
90
|
+
const context = { signOutHref: '/signout' }
|
|
91
|
+
|
|
92
|
+
// Act
|
|
93
|
+
const html = render('error/not-authorised.njk', context)
|
|
94
|
+
|
|
95
|
+
// Assert
|
|
96
|
+
expect(html).toContain(
|
|
97
|
+
'<a href="/signout" role="button" draggable="false" class="govuk-button" data-module="govuk-button">Sign out</a>'
|
|
98
|
+
)
|
|
99
|
+
expect(html).not.toContain('Sign in')
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
test('not authorised prefers sign out over sign in when both are given', () => {
|
|
103
|
+
// Arrange
|
|
104
|
+
const context = { signInHref: '/auth/login', signOutHref: '/signout' }
|
|
105
|
+
|
|
106
|
+
// Act
|
|
107
|
+
const html = render('error/not-authorised.njk', context)
|
|
108
|
+
|
|
109
|
+
// Assert
|
|
110
|
+
expect(html).toContain('href="/signout"')
|
|
111
|
+
expect(html).toContain('Sign out')
|
|
112
|
+
expect(html).not.toContain('Sign in')
|
|
113
|
+
expect(html).not.toContain('/auth/login')
|
|
114
|
+
})
|
|
115
|
+
|
|
88
116
|
test('not authorised shows the heading and the support link', () => {
|
|
89
117
|
// Arrange
|
|
90
118
|
const context = {
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
<h1 class="govuk-heading-l">Sorry, you are not authorised to view this page</h1>
|
|
7
7
|
<p class="govuk-body">Check your details are correct and try again.</p>
|
|
8
8
|
<p class="govuk-body">If you think this is incorrect <a class="govuk-link" href="{{ errorPages.contactHref }}">contact our support team</a>.</p>
|
|
9
|
-
{% if
|
|
9
|
+
{% if signOutHref %}
|
|
10
|
+
<a href="{{ signOutHref }}" role="button" draggable="false" class="govuk-button" data-module="govuk-button">Sign out</a>
|
|
11
|
+
{% elif signInHref %}
|
|
10
12
|
<a href="{{ signInHref }}" role="button" draggable="false" class="govuk-button" data-module="govuk-button">Sign in</a>
|
|
11
13
|
{% endif %}
|
|
12
14
|
</div>
|