Skip to content

Commit

Permalink
Show when the feedback has been published
Browse files Browse the repository at this point in the history
Note the mechanism used has accessibility issues that must be addressed before the feature flag is removed.

Refs #1941, alphagov/govuk-design-system-backlog#28 (comment)
  • Loading branch information
thewilkybarkid committed Sep 27, 2024
1 parent bbf078e commit 4d47598
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
3 changes: 0 additions & 3 deletions integration/writing-feedback.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ test.extend(canLogIn).extend(areLoggedIn).extend(canWriteFeedback).extend(willPu

await expect(page.getByRole('heading', { level: 1 })).toHaveText('We’re publishing your feedback')

await page.waitForTimeout(500)
await page.reload()

await expect(page.getByRole('heading', { level: 1 })).toHaveText('Feedback published')
},
)
Expand Down
1 change: 1 addition & 0 deletions src/WriteFeedbackFlow/PublishingPage/PublishingPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { Uuid } from '../../types/index.js'
export const PublishingPage = ({ feedbackId }: { feedbackId: Uuid.Uuid }) =>
StreamlinePageResponse({
title: plainText`We’re publishing your feedback`,
head: html`<meta http-equiv="refresh" content="2" />`,
main: html`
<h1>We’re publishing your feedback</h1>
Expand Down
3 changes: 3 additions & 0 deletions src/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface Page {
readonly locale?: SupportedLocale
readonly title: PlainText
readonly description?: PlainText
readonly head?: Html
readonly type?: 'two-up' | 'streamline'
readonly content: Html
readonly skipLinks?: ReadonlyArray<[Html, string]>
Expand Down Expand Up @@ -82,6 +83,7 @@ export function page({
locale = DefaultLocale,
title,
description,
head,
type,
content,
skipLinks = [],
Expand Down Expand Up @@ -131,6 +133,7 @@ export function page({
: ''}
<link rel="icon" href="${assets['favicon.ico']}" sizes="32x32" />
<link rel="icon" href="${assets['favicon.svg']}" type="image/svg+xml" />
${head ?? ''}
</head>
<body ${rawHtml(type === 'two-up' ? `class="${type}"` : '')}>
${skipLinks.length > 0
Expand Down
2 changes: 2 additions & 0 deletions src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface StreamlinePageResponse {
readonly status: Status
readonly title: Page['title']
readonly description?: Page['description']
readonly head?: Html
readonly nav?: Html
readonly main: Html
readonly skipToLabel: 'form' | 'main'
Expand Down Expand Up @@ -202,6 +203,7 @@ export const toPage = ({
locale: locale !== DefaultLocale ? locale : undefined,
title: response.title,
description: response.description,
head: response._tag === 'StreamlinePageResponse' ? response.head : undefined,
content: html`
${response.nav ? html` <nav>${response.nav}</nav>` : ''}
Expand Down
1 change: 1 addition & 0 deletions test/WriteFeedbackFlow/PublishingPage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('PublishingPage', () => {
canonical: Routes.WriteFeedbackPublishing.href({ feedbackId }),
status: StatusCodes.OK,
title: expect.stringContaining('publishing'),
head: expect.stringContaining('refresh'),
main: expect.stringContaining('publishing'),
skipToLabel: 'main',
js: [],
Expand Down

0 comments on commit 4d47598

Please sign in to comment.