Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
895c79f
CCM-8354 CustomFieldsForm component
nicki-nhs Apr 30, 2026
4cc4e77
CCM-8354 TestPersonalisationForm
nicki-nhs May 1, 2026
ceffc55
CCM-8354 SendTestMessage
nicki-nhs May 5, 2026
d04a72d
CCM-8354 Send test app message page
nicki-nhs May 5, 2026
f940c02
CCM-8354 Content
nicki-nhs May 5, 2026
e780301
CCM-8354 NHS number validation
nicki-nhs May 5, 2026
5cd1097
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
nicki-nhs May 5, 2026
f345d81
CCM-8354 Update server action and custom personalisation handling
nicki-nhs May 5, 2026
a2866cf
CCM-8354 Add additional tests for letter render server action
nicki-nhs May 5, 2026
9e70a36
CCM-8354 Refactor letter render to use shared components
nicki-nhs May 5, 2026
1d6fac4
CCM-8354 Commit hook fix
nicki-nhs May 5, 2026
0837cfc
CCM-8354 Fix page structure and styling issues
nicki-nhs May 6, 2026
d42e308
CCM-8354 Rename test recipient to example recipient
nicki-nhs May 6, 2026
cdb8df7
CCM-8354 Update select to choose and add playwright tests
nicki-nhs May 6, 2026
563c3cd
CCM-8354 Revert schema changes
nicki-nhs May 6, 2026
b48e276
CCM-8354 Update playwright tests and add customPersonalisation fields…
nicki-nhs May 6, 2026
48c4fc3
CCM-8354 Improve test coverage
nicki-nhs May 6, 2026
a493ed8
CCM-8354 Fix type issue
nicki-nhs May 6, 2026
757dcc4
CCM-8354 Fix tests
nicki-nhs May 6, 2026
65982f2
CCM-8354 Accessibility test
nicki-nhs May 6, 2026
d108208
CCM-8354 Remove full width styling on recipient
nicki-nhs May 6, 2026
92029df
CCM-8354 Move test file
nicki-nhs May 6, 2026
8dfe47e
CCM-8354 Restore autocomplete and update tests
nicki-nhs May 7, 2026
b596c67
CCM-8354 Refactor template factory functions for digital templates
nicki-nhs May 7, 2026
1c6252d
CCM-8354 Refactor template factory functions for digital templates
nicki-nhs May 7, 2026
8436f90
CCM-8354 Resolve type error and review feedback
nicki-nhs May 8, 2026
c1fbce2
CCM-8354 Resolve type error
nicki-nhs May 8, 2026
dfa9b5d
Merge branch 'main' of https://github.com/NHSDigital/nhs-notify-web-t…
nicki-nhs May 8, 2026
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ describe('CombinedLetterErrorSummary', () => {

await waitFor(() => {
expect(screen.getByTestId('error-summary')).toBeInTheDocument();
expect(screen.getByTestId('error-summary')).toHaveTextContent(
'There is a problem'
);
expect(
screen.getByRole('link', { name: 'Field is required' })
).toBeInTheDocument();
Expand All @@ -89,12 +92,39 @@ describe('CombinedLetterErrorSummary', () => {

await waitFor(() => {
expect(screen.getByTestId('error-summary')).toBeInTheDocument();
expect(screen.getByTestId('error-summary')).toHaveTextContent(
Comment thread
chris-elliott-nhsd marked this conversation as resolved.
'There is a problem'
);
expect(
screen.getByRole('link', { name: 'Render failed' })
).toBeInTheDocument();
});
});

it('displays recipient validation error in summary banner with the correct link target', async () => {
renderWithLetterRenderError({
formErrors: [],
fieldErrors: {
'system-personalisation-pack-id-shortFormRender': [
'Select an example recipient',
],
},
});

await waitFor(() => {
expect(screen.getByTestId('error-summary')).toHaveTextContent(
'There is a problem'
);

expect(
screen.getByRole('link', { name: 'Select an example recipient' })
).toHaveAttribute(
'href',
'#system-personalisation-pack-id-shortFormRender'
);
});
});

it('prefers parentErrorState over letterRenderErrorState when both are set', async () => {
mockUseNHSNotifyForm.mockReturnValue([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ describe('LetterRenderForm', () => {
formErrors: [],
fieldErrors: {
'system-personalisation-pack-id-shortFormRender': [
'Choose example recipient',
'Choose an example recipient',
],
},
},
Expand All @@ -287,18 +287,20 @@ describe('LetterRenderForm', () => {
initialState
);

expect(screen.getByText('Choose example recipient')).toBeInTheDocument();
expect(
screen.getByTestId(
'error-system-personalisation-pack-id-shortFormRender'
)
).toHaveTextContent('Choose an example recipient');

const formGroup = screen
.getByText('Choose example recipient')
.getByTestId('error-system-personalisation-pack-id-shortFormRender')
.closest('.nhsuk-form-group');

expect(formGroup).toHaveClass('nhsuk-form-group--error');

const select = screen.getByRole('combobox', {
name: 'Example recipient',
});

expect(select).toHaveClass('nhsuk-select--error');
});

Expand All @@ -308,7 +310,7 @@ describe('LetterRenderForm', () => {
formErrors: [],
fieldErrors: {
'system-personalisation-pack-id-longFormRender': [
'Choose example recipient',
'Choose an example recipient',
],
},
},
Expand All @@ -319,18 +321,20 @@ describe('LetterRenderForm', () => {
initialState
);

expect(screen.getByText('Choose example recipient')).toBeInTheDocument();
expect(
screen.getByTestId(
'error-system-personalisation-pack-id-longFormRender'
)
).toHaveTextContent('Choose an example recipient');

const formGroup = screen
.getByText('Choose example recipient')
.getByTestId('error-system-personalisation-pack-id-longFormRender')
.closest('.nhsuk-form-group');

expect(formGroup).toHaveClass('nhsuk-form-group--error');

const select = screen.getByRole('combobox', {
name: 'Example recipient',
});

expect(select).toHaveClass('nhsuk-select--error');
});

Expand Down Expand Up @@ -450,7 +454,7 @@ describe('LetterRenderForm', () => {
formErrors: [],
fieldErrors: {
'system-personalisation-pack-id-shortFormRender': [
'Choose example recipient',
'Choose an example recipient',
],
'custom-appointmentDate-shortFormRender': [
'Enter example data for appointmentDate',
Expand Down Expand Up @@ -481,7 +485,7 @@ describe('LetterRenderForm', () => {
formErrors: [],
fieldErrors: {
'system-personalisation-pack-id-longFormRender': [
'Choose example recipient',
'Choose an example recipient',
],
'custom-appointmentDate-longFormRender': [
'Enter example data for appointmentDate',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ describe('LetterRenderTab', () => {
);
});

it('displays validation error when no recipient selected', async () => {
it('displays inline validation error and sets error state when no recipient selected', async () => {
mockUpdateLetterPreview.mockResolvedValue(
createMockState({
errorState: {
Expand Down Expand Up @@ -561,8 +561,19 @@ describe('LetterRenderTab', () => {
});

expect(
await screen.findByText('Select an example recipient')
).toBeInTheDocument();
await screen.findByTestId(
'error-system-personalisation-pack-id-shortFormRender'
)
).toHaveTextContent('Select an example recipient');

expect(mockSetLetterRenderErrorState).toHaveBeenCalledWith({
formErrors: [],
fieldErrors: {
'system-personalisation-pack-id-shortFormRender': [
'Select an example recipient',
],
},
});
});

it('forwards error state to LetterRenderErrorProvider after submission', async () => {
Expand Down
Loading
Loading