Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
53e6105
CCM-11494 Routing utils
nicki-nhs Nov 25, 2025
6b1f877
CCM-11494 Update interpolate function
nicki-nhs Nov 25, 2025
a57c962
CCM-11494 Update arrow icons
nicki-nhs Nov 25, 2025
571a970
CCM-11494 URLs for choosing templates
nicki-nhs Nov 25, 2025
4df03bb
CCM-11494 ChannelTemplate supports accessible formats and translated …
nicki-nhs Nov 25, 2025
f07f45f
CCM-11494 Add additional class to fallback conditions
nicki-nhs Nov 25, 2025
000c260
CCm-11494 MessagePlanBlock supports alternative letter formats
nicki-nhs Nov 25, 2025
fc031b7
CCM-11494 get conditional templates for a cascade item
nicki-nhs Nov 25, 2025
39ac026
CCM-11494 Update MessagePlanChannelList to support conditional templates
nicki-nhs Nov 25, 2025
eb204ce
CCM-11494 MessagePlanConditionalTemplates
nicki-nhs Nov 25, 2025
3c696ce
CCM-11494 Conditional templates content
nicki-nhs Nov 25, 2025
f1f6c4f
CCM-11494 Update imports
nicki-nhs Nov 25, 2025
74fcb1c
CCM-11494 Update choose-templates snapshot
nicki-nhs Nov 25, 2025
b42cc08
CCM-11494 Update snapshot for CreateEditMessagePlan
nicki-nhs Nov 25, 2025
6caf062
CCM-11494 Update cascade group
nicki-nhs Nov 25, 2025
8edecff
CCM-11494 Update enum
nicki-nhs Nov 26, 2025
012007e
CCM-11494 Remove conditional templates action
nicki-nhs Nov 26, 2025
3b4d25d
CCM-11494 Update tests and snapshots
nicki-nhs Nov 26, 2025
b21525b
CCM-11494 Update unit tests and snapshots
nicki-nhs Nov 26, 2025
c2bda1f
CCM-11494 Update routing config factory to support conditional templates
nicki-nhs Nov 26, 2025
94bd4c1
CCM-11494 Update factory
nicki-nhs Nov 26, 2025
1423493
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
nicki-nhs Nov 26, 2025
71320e1
CCCM-11494 component test
nicki-nhs Nov 26, 2025
3b38b7d
CCM-11494 Fix type issue
nicki-nhs Nov 27, 2025
75370bf
CCM-11544 Create alternative letters in test data
nicki-nhs Nov 27, 2025
fbe48a4
CCM-11544 Fix monospace styling
nicki-nhs Nov 27, 2025
73a3502
CCM-11544 Fix types on template factory
nicki-nhs Nov 27, 2025
4b937b9
CCM-11544 Fix styling on choose template page
nicki-nhs Nov 27, 2025
8b9d2fe
CCM-11544 Choose large print template
nicki-nhs Nov 28, 2025
0dd4fee
CCM-11544 Move content line
nicki-nhs Dec 1, 2025
2bb39d2
CCM-11544 Get language templates
nicki-nhs Dec 1, 2025
bfef505
CCM-11544 Rename function and remove unused import
nicki-nhs Dec 1, 2025
b77f5c1
CCM-11544 routing util getSelectedLanguageTemplateIds
nicki-nhs Dec 2, 2025
a4266d9
CCM-11544 Routing util for adding language templates
nicki-nhs Dec 2, 2025
7a73ebe
CCM-11544 Test coverage for letter template type guard
nicki-nhs Dec 2, 2025
31c856a
CCM-11544 Add letter type to template filter
nicki-nhs Dec 2, 2025
8341ddd
CCM-11544 Styling fix
nicki-nhs Dec 2, 2025
ec1cebb
CCM-11544 Rename
nicki-nhs Dec 2, 2025
e18f249
CCM-11544 Add missing key
nicki-nhs Dec 2, 2025
34a3898
CCM-11544 Update return type on get language letters function
nicki-nhs Dec 2, 2025
4b32178
CCM-11544 Languag
nicki-nhs Dec 2, 2025
357097c
CCM-11544 Routing utils for language templates
nicki-nhs Dec 2, 2025
158fe5a
CCM-11544 select language templates
nicki-nhs Dec 3, 2025
ae376b1
CCM-11544 Remove redundant wrapping div
nicki-nhs Dec 3, 2025
7dc89de
CCM-11544 Add test IDs
nicki-nhs Dec 8, 2025
a5c4476
CCM-11544 Routing playwright tests
nicki-nhs Dec 8, 2025
b1df487
CCM-11544 Add new pages to protected routes tests
nicki-nhs Dec 8, 2025
d79fbd3
Back link refactor and tests
nicki-nhs Dec 8, 2025
671ab15
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
nicki-nhs Dec 8, 2025
070a0f6
CCM-11544 Rename function
nicki-nhs Dec 8, 2025
608fb94
CCM-11544 Lint and type fixes
nicki-nhs Dec 8, 2025
c9f6e28
CCM-11544 More back link updates
nicki-nhs Dec 9, 2025
745bb31
CCM-11544 Typecheck fixes
nicki-nhs Dec 9, 2025
7ad5dba
CCM-11544 Optimistic locking for alternative letter types
nicki-nhs Dec 9, 2025
83fb9d4
CCM-11544 Handle lock number and update snapshots
nicki-nhs Dec 9, 2025
b0ea30c
CCM-11544 Missing unit test
nicki-nhs Dec 9, 2025
f8c777d
CCM-11544 Fix error handling
nicki-nhs Dec 10, 2025
24b5d2e
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
nicki-nhs Dec 10, 2025
03b4bce
CCM-11544 Update error snapshots
nicki-nhs Dec 10, 2025
9ef13cb
CCM-11544 Test failures
nicki-nhs Dec 11, 2025
8295850
CCM-11544 Fix tests
nicki-nhs Dec 12, 2025
29b3ea0
CCM-11544 More test fixes
nicki-nhs Dec 12, 2025
dd40975
CCM-11544 More test fixes
nicki-nhs Dec 15, 2025
80c78bd
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
nicki-nhs Dec 15, 2025
4736f72
CCM-11544 Small fix
nicki-nhs Dec 15, 2025
e47562c
CCM-11544 Test fixes
nicki-nhs Dec 15, 2025
7540ff4
CCM-11544 Test fixes
nicki-nhs Dec 15, 2025
c548fd9
CCM-11544 Test fixes
nicki-nhs Dec 15, 2025
33619cf
CCM-11544 Test fixes
nicki-nhs Dec 15, 2025
6f23e01
CCM-11544 Add lockNumber to preview and back links
nicki-nhs Dec 16, 2025
46f9560
CCM-11544 Fix link styling
nicki-nhs Dec 16, 2025
6776599
CCM-11544 More lock number fixes
nicki-nhs Dec 16, 2025
5c73d26
CCM-11544 More lock number fixes
nicki-nhs Dec 17, 2025
d1cbb09
CCM-11544 More lock number fixes
nicki-nhs Dec 17, 2025
4bc92a5
CCM-11544 Fix types
nicki-nhs Dec 17, 2025
50a1677
CCM-11544 Test updates and copy fix
nicki-nhs Dec 19, 2025
9184337
CCM-11544 Fixes
nicki-nhs Dec 19, 2025
679e624
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
nicki-nhs Dec 19, 2025
4de415b
CCM-11544 Test fixes
nicki-nhs Dec 19, 2025
5a16107
CCM-11544 Test fixes
nicki-nhs Dec 19, 2025
d4bfed5
CCM-11544 Test fixes
nicki-nhs Dec 19, 2025
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
2 changes: 1 addition & 1 deletion frontend/public/lib/assets/icons/icon-arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/public/lib/assets/icons/icon-arrow-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/public/lib/assets/icons/icon-arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`ChooseATemplateTypePage 1`] = `
<DocumentFragment>
<a
class="nhsuk-back-link"
data-testid="back-to-templates-link"
data-testid="back-link-top"
href="/message-templates"
>
Back to all templates
Expand Down

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions frontend/src/__tests__/app/choose-templates/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ describe('ChooseTemplatesPage', () => {
const appTemplateId = 'd3a2c6ba-438a-4bf4-b94a-7c64c6528e7f';
const smsTemplateId = '5f7c3e1d-9b1a-4d3a-8f3e-2c6b8e9f1a2b';
const letterTemplateId = '9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d';
const frenchLetterTemplateId = '1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d';
const spanishLetterTemplateId = '6d5c4b3a-2f1e-0d9c-8b7a-6f5e4d3c2b1a';

const planWithMultiple: RoutingConfig = {
...routingConfig,
Expand Down Expand Up @@ -210,6 +212,16 @@ describe('ChooseTemplatesPage', () => {
channel: 'LETTER',
channelType: 'primary',
defaultTemplateId: letterTemplateId,
conditionalTemplates: [
{
language: 'fr',
templateId: frenchLetterTemplateId,
},
{
language: 'es',
templateId: spanishLetterTemplateId,
},
],
},
],
};
Expand All @@ -221,6 +233,16 @@ describe('ChooseTemplatesPage', () => {
...LETTER_TEMPLATE,
id: letterTemplateId,
},
[frenchLetterTemplateId]: {
...LETTER_TEMPLATE,
name: 'French Letter Template',
id: frenchLetterTemplateId,
},
[spanishLetterTemplateId]: {
...LETTER_TEMPLATE,
name: 'Spanish Letter Template',
id: spanishLetterTemplateId,
},
};

getMessagePlanMock.mockResolvedValueOnce(planWithMultiple);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports[`matches snapshot 1`] = `
</div>
<p>
<a
data-testid="back-link"
data-testid="back-link-bottom"
href="/message-plans"
>
Go back
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ exports[`ChooseEmailTemplate page renders Email template selection 1`] = `
<div
class="nhsuk-grid-column-full"
>
<span
class="nhsuk-caption-l"
<div
class="nhsuk-u-reading-width"
>
Autumn Campaign Plan
</span>
<h1
class="nhsuk-heading-l"
>
Choose an email template
</h1>
<span
class="nhsuk-caption-l"
>
Autumn Campaign Plan
</span>
<h1
class="nhsuk-heading-xl"
>
Choose an email template
</h1>
</div>
<form
action="javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')"
>
Expand All @@ -46,7 +50,7 @@ exports[`ChooseEmailTemplate page renders Email template selection 1`] = `
/>
<dl
class="nhsuk-summary-list"
data-testid="previous-selection-summary"
data-testid="previous-selection-details"
>
<div
class="nhsuk-summary-list__row"
Expand All @@ -70,7 +74,8 @@ exports[`ChooseEmailTemplate page renders Email template selection 1`] = `
class="nhsuk-grid-column-full"
>
<div
class="nhsuk-hint"
class="nhsuk-hint nhsuk-u-reading-width"
data-testid="table-hint"
>
Choose one option
</div>
Expand Down Expand Up @@ -213,18 +218,15 @@ exports[`ChooseEmailTemplate page renders Email template selection 1`] = `
>

</span>
<div
class="actionLinksWrapper"
<a
aria-label="Preview"
class="nhsuk-u-margin-bottom-2 nhsuk-link"
data-testid="email-template-id-preview-link"
href="/message-plans/choose-email-template/fbb81055-79b9-4759-ac07-d191ae57be34/preview-template/email-template-id?lockNumber=42"
id="preview-template-link-0"
>
<a
aria-label="Preview"
data-testid="email-template-id-preview-link"
href="/message-plans/choose-email-template/fbb81055-79b9-4759-ac07-d191ae57be34/preview-template/email-template-id"
id="preview-template-link-0"
>
Preview
</a>
</div>
Preview
</a>
</td>
</tr>
</tbody>
Expand All @@ -247,7 +249,8 @@ exports[`ChooseEmailTemplate page renders Email template selection 1`] = `
Save and continue
</button>
<a
class="nhsuk-u-font-size-19 inline-block nhsuk-u-margin-left-3 nhsuk-u-padding-top-3"
class="nhsuk-u-font-size-19 inline-block nhsuk-u-margin-left-4 nhsuk-u-padding-top-3"
data-testid="back-link-bottom"
href="/message-plans/choose-templates/fbb81055-79b9-4759-ac07-d191ae57be34"
>
Go back
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ exports[`PreviewEmailTemplateFromMessagePlan page renders Email template preview
<DocumentFragment>
<a
class="nhsuk-back-link"
href="/message-plans/choose-email-template/fbb81055-79b9-4759-ac07-d191ae57be34"
data-testid="back-link-top"
href="/message-plans/choose-email-template/fbb81055-79b9-4759-ac07-d191ae57be34?lockNumber=5"
>
Go back
</a>
Expand Down Expand Up @@ -49,7 +50,8 @@ exports[`PreviewEmailTemplateFromMessagePlan page renders Email template preview
Template ID
</dt>
<dd
class="nhsuk-summary-list__value"
class="nhsuk-summary-list__value monospace-font"
data-testid="preview-template-id"
>
email-template-id
</dd>
Expand Down Expand Up @@ -128,13 +130,13 @@ exports[`PreviewEmailTemplateFromMessagePlan page renders Email template preview
</div>
</dl>
</div>
<p>
<a
href="/message-plans/choose-email-template/fbb81055-79b9-4759-ac07-d191ae57be34"
>
Go back
</a>
</p>
<a
class="nhsuk-link nhsuk-body-m nhsuk-u-display-inline-block"
data-testid="back-link-bottom"
href="/message-plans/choose-email-template/fbb81055-79b9-4759-ac07-d191ae57be34?lockNumber=5"
>
Go back
</a>
</div>
</div>
</main>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,38 @@ const getTemplateMock = jest.mocked(getTemplate);
const redirectMock = jest.mocked(redirect);

describe('PreviewEmailTemplateFromMessagePlan page', () => {
it('should redirect to choose-templates when lockNumber is invalid', async () => {
await PreviewEmailTemplateFromMessagePlan({
params: Promise.resolve({
routingConfigId: 'routing-config-id',
templateId: 'template-id',
}),
searchParams: Promise.resolve({
lockNumber: 'invalid',
}),
});

expect(redirectMock).toHaveBeenCalledWith(
'/message-plans/choose-templates/routing-config-id',
'replace'
);
});

it('should redirect to choose-templates when lockNumber is missing', async () => {
await PreviewEmailTemplateFromMessagePlan({
params: Promise.resolve({
routingConfigId: 'routing-config-id',
templateId: 'template-id',
}),
searchParams: Promise.resolve({}),
});

expect(redirectMock).toHaveBeenCalledWith(
'/message-plans/choose-templates/routing-config-id',
'replace'
);
});

it('should redirect to invalid page with invalid template id', async () => {
getTemplateMock.mockResolvedValueOnce(undefined);

Expand All @@ -21,6 +53,9 @@ describe('PreviewEmailTemplateFromMessagePlan page', () => {
routingConfigId: 'routing-config-id',
templateId: 'invalid-template-id',
}),
searchParams: Promise.resolve({
lockNumber: '0',
}),
});

expect(getTemplateMock).toHaveBeenCalledWith('invalid-template-id');
Expand All @@ -39,6 +74,9 @@ describe('PreviewEmailTemplateFromMessagePlan page', () => {
routingConfigId: ROUTING_CONFIG.id,
templateId: EMAIL_TEMPLATE.id,
}),
searchParams: Promise.resolve({
lockNumber: '5',
}),
});

const container = render(page);
Expand Down
Loading
Loading