Skip to content

Commit 4f9b220

Browse files
authored
CCM-9134: Refactor pa11y config and add more proofing tests (#576)
1 parent 642624d commit 4f9b220

19 files changed

+270
-107
lines changed

frontend/src/__tests__/components/forms/PreviewEmailTemplate/PreviewEmailTemplate.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe('Preview email form renders', () => {
4040
initialState={mockDeep<TemplateFormState<EmailTemplate>>({
4141
validationError: undefined,
4242
name: 'test-template-email',
43+
templateStatus: 'NOT_YET_SUBMITTED',
4344
subject: 'template-subject-line',
4445
message: 'message',
4546
id: 'template-id',
@@ -61,6 +62,7 @@ describe('Preview email form renders', () => {
6162
initialState={mockDeep<TemplateFormState<EmailTemplate>>({
6263
validationError: undefined,
6364
name: 'test-template-email',
65+
templateStatus: 'NOT_YET_SUBMITTED',
6466
subject: 'template-subject-line',
6567
message: 'message',
6668
id: 'template-id',
@@ -82,6 +84,7 @@ describe('Preview email form renders', () => {
8284
},
8385
},
8486
name: 'test-template-email',
87+
templateStatus: 'NOT_YET_SUBMITTED',
8588
subject: 'template-subject-line',
8689
message: 'message',
8790
id: 'template-id',
@@ -98,6 +101,7 @@ describe('Preview email form renders', () => {
98101
initialState={mockDeep<TemplateFormState<EmailTemplate>>({
99102
validationError: undefined,
100103
name: 'test-template-email',
104+
templateStatus: 'NOT_YET_SUBMITTED',
101105
subject: 'template-subject-line',
102106
message: 'message',
103107
id: 'template-id',
@@ -128,6 +132,7 @@ describe('Preview email form renders', () => {
128132
initialState={mockDeep<TemplateFormState<EmailTemplate>>({
129133
validationError: undefined,
130134
name: 'test-template-email',
135+
templateStatus: 'NOT_YET_SUBMITTED',
131136
subject: 'template-subject-line',
132137
message,
133138
id: 'template-id',
@@ -151,6 +156,7 @@ describe('Preview email form renders', () => {
151156
initialState={mockDeep<TemplateFormState<EmailTemplate>>({
152157
validationError: undefined,
153158
name: 'test-template-email',
159+
templateStatus: 'NOT_YET_SUBMITTED',
154160
subject: 'template-subject-line',
155161
message: 'message',
156162
id: 'template-id',

frontend/src/__tests__/components/forms/PreviewEmailTemplate/__snapshots__/PreviewEmailTemplate.test.tsx.snap

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ exports[`Preview email form renders Client-side validation triggers 1`] = `
118118
>
119119
<strong
120120
class="nhsuk-tag"
121-
/>
121+
data-test-id="status-tag-not-yet-submitted"
122+
>
123+
Not yet submitted
124+
</strong>
122125
</dd>
123126
</div>
124127
</dl>
@@ -407,7 +410,10 @@ exports[`Preview email form renders matches error snapshot 1`] = `
407410
>
408411
<strong
409412
class="nhsuk-tag"
410-
/>
413+
data-test-id="status-tag-not-yet-submitted"
414+
>
415+
Not yet submitted
416+
</strong>
411417
</dd>
412418
</div>
413419
</dl>
@@ -669,7 +675,10 @@ exports[`Preview email form renders matches snapshot when navigating from edit s
669675
>
670676
<strong
671677
class="nhsuk-tag"
672-
/>
678+
data-test-id="status-tag-not-yet-submitted"
679+
>
680+
Not yet submitted
681+
</strong>
673682
</dd>
674683
</div>
675684
</dl>
@@ -914,7 +923,10 @@ exports[`Preview email form renders matches snapshot when navigating from manage
914923
>
915924
<strong
916925
class="nhsuk-tag"
917-
/>
926+
data-test-id="status-tag-not-yet-submitted"
927+
>
928+
Not yet submitted
929+
</strong>
918930
</dd>
919931
</div>
920932
</dl>

frontend/src/__tests__/components/forms/PreviewNHSAppTemplate/PreviewNHSAppTemplate.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ describe('Preview nhs app form renders', () => {
4141
validationError: undefined,
4242
id: 'template-id',
4343
name: 'test-template-nhs app',
44+
templateStatus: 'NOT_YET_SUBMITTED',
4445
message: 'message',
4546
})}
4647
/>
@@ -61,6 +62,7 @@ describe('Preview nhs app form renders', () => {
6162
validationError: undefined,
6263
id: 'template-id',
6364
name: 'test-template-nhs app',
65+
templateStatus: 'NOT_YET_SUBMITTED',
6466
message: 'message',
6567
})}
6668
/>
@@ -81,6 +83,7 @@ describe('Preview nhs app form renders', () => {
8183
},
8284
id: 'template-id',
8385
name: 'test-template-nhs app',
86+
templateStatus: 'NOT_YET_SUBMITTED',
8487
message: 'message',
8588
})}
8689
/>
@@ -96,6 +99,7 @@ describe('Preview nhs app form renders', () => {
9699
validationError: undefined,
97100
id: 'template-id',
98101
name: 'test-template-nhs app',
102+
templateStatus: 'NOT_YET_SUBMITTED',
99103
message: 'message',
100104
})}
101105
/>
@@ -125,6 +129,7 @@ describe('Preview nhs app form renders', () => {
125129
validationError: undefined,
126130
id: 'template-id',
127131
name: 'test-template-nhs app',
132+
templateStatus: 'NOT_YET_SUBMITTED',
128133
message,
129134
})}
130135
/>
@@ -143,6 +148,7 @@ describe('Preview nhs app form renders', () => {
143148
initialState={mockDeep<TemplateFormState<NHSAppTemplate>>({
144149
id: 'template-id',
145150
name: 'test-template-nhs app',
151+
templateStatus: 'NOT_YET_SUBMITTED',
146152
message: 'example',
147153
})}
148154
/>

frontend/src/__tests__/components/forms/PreviewNHSAppTemplate/__snapshots__/PreviewNHSAppTemplate.test.tsx.snap

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ exports[`Preview nhs app form renders Client-side validation triggers 1`] = `
118118
>
119119
<strong
120120
class="nhsuk-tag"
121-
/>
121+
data-test-id="status-tag-not-yet-submitted"
122+
>
123+
Not yet submitted
124+
</strong>
122125
</dd>
123126
</div>
124127
</dl>
@@ -382,7 +385,10 @@ exports[`Preview nhs app form renders matches error snapshot 1`] = `
382385
>
383386
<strong
384387
class="nhsuk-tag"
385-
/>
388+
data-test-id="status-tag-not-yet-submitted"
389+
>
390+
Not yet submitted
391+
</strong>
386392
</dd>
387393
</div>
388394
</dl>
@@ -619,7 +625,10 @@ exports[`Preview nhs app form renders matches snapshot when navigating from edit
619625
>
620626
<strong
621627
class="nhsuk-tag"
622-
/>
628+
data-test-id="status-tag-not-yet-submitted"
629+
>
630+
Not yet submitted
631+
</strong>
623632
</dd>
624633
</div>
625634
</dl>
@@ -839,7 +848,10 @@ exports[`Preview nhs app form renders matches snapshot when navigating from mana
839848
>
840849
<strong
841850
class="nhsuk-tag"
842-
/>
851+
data-test-id="status-tag-not-yet-submitted"
852+
>
853+
Not yet submitted
854+
</strong>
843855
</dd>
844856
</div>
845857
</dl>

frontend/src/__tests__/components/forms/PreviewSMSTemplate/PreviewSMSTemplate.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe('Review sms form renders', () => {
4040
initialState={mockDeep<TemplateFormState<SMSTemplate>>({
4141
validationError: undefined,
4242
name: 'test-template-sms',
43+
templateStatus: 'NOT_YET_SUBMITTED',
4344
message: 'message',
4445
id: 'template-id',
4546
})}
@@ -60,6 +61,7 @@ describe('Review sms form renders', () => {
6061
initialState={mockDeep<TemplateFormState<SMSTemplate>>({
6162
validationError: undefined,
6263
name: 'test-template-sms',
64+
templateStatus: 'NOT_YET_SUBMITTED',
6365
message: 'message',
6466
id: 'template-id',
6567
})}
@@ -80,6 +82,7 @@ describe('Review sms form renders', () => {
8082
},
8183
},
8284
name: 'test-template-sms',
85+
templateStatus: 'NOT_YET_SUBMITTED',
8386
message: 'message',
8487
id: 'template-id',
8588
})}
@@ -95,6 +98,7 @@ describe('Review sms form renders', () => {
9598
initialState={mockDeep<TemplateFormState<SMSTemplate>>({
9699
validationError: undefined,
97100
name: 'test-template-sms',
101+
templateStatus: 'NOT_YET_SUBMITTED',
98102
message: 'message',
99103
id: 'template-id',
100104
})}
@@ -124,6 +128,7 @@ describe('Review sms form renders', () => {
124128
initialState={mockDeep<TemplateFormState<SMSTemplate>>({
125129
validationError: undefined,
126130
name: 'test-template-sms',
131+
templateStatus: 'NOT_YET_SUBMITTED',
127132
message,
128133
id: 'template-id',
129134
})}
@@ -142,6 +147,7 @@ describe('Review sms form renders', () => {
142147
<PreviewSMSTemplate
143148
initialState={mockDeep<TemplateFormState<SMSTemplate>>({
144149
name: 'test-template-sms',
150+
templateStatus: 'NOT_YET_SUBMITTED',
145151
message: 'example',
146152
id: 'template-id',
147153
})}

frontend/src/__tests__/components/forms/PreviewSMSTemplate/__snapshots__/PreviewSMSTemplate.test.tsx.snap

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ exports[`Review sms form renders Client-side validation triggers 1`] = `
118118
>
119119
<strong
120120
class="nhsuk-tag"
121-
/>
121+
data-test-id="status-tag-not-yet-submitted"
122+
>
123+
Not yet submitted
124+
</strong>
122125
</dd>
123126
</div>
124127
</dl>
@@ -382,7 +385,10 @@ exports[`Review sms form renders matches error snapshot 1`] = `
382385
>
383386
<strong
384387
class="nhsuk-tag"
385-
/>
388+
data-test-id="status-tag-not-yet-submitted"
389+
>
390+
Not yet submitted
391+
</strong>
386392
</dd>
387393
</div>
388394
</dl>
@@ -619,7 +625,10 @@ exports[`Review sms form renders matches snapshot when navigating from edit scre
619625
>
620626
<strong
621627
class="nhsuk-tag"
622-
/>
628+
data-test-id="status-tag-not-yet-submitted"
629+
>
630+
Not yet submitted
631+
</strong>
623632
</dd>
624633
</div>
625634
</dl>
@@ -839,7 +848,10 @@ exports[`Review sms form renders matches snapshot when navigating from manage te
839848
>
840849
<strong
841850
class="nhsuk-tag"
842-
/>
851+
data-test-id="status-tag-not-yet-submitted"
852+
>
853+
Not yet submitted
854+
</strong>
843855
</dd>
844856
</div>
845857
</dl>

frontend/src/__tests__/components/molecules/__snapshots__/PreviewTemplateDetails.test.tsx.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ exports[`PreviewTemplateDetailsEmail matches snapshot 1`] = `
5555
>
5656
<strong
5757
class="nhsuk-tag nhsuk-tag--grey"
58+
data-test-id="status-tag-submitted"
5859
>
5960
Submitted
6061
</strong>
@@ -174,6 +175,7 @@ exports[`PreviewTemplateDetailsLetter if status is PROOF_AVAILABLE, but no proof
174175
>
175176
<strong
176177
class="nhsuk-tag nhsuk-tag--orange"
178+
data-test-id="status-tag-proof-available"
177179
>
178180
Proof available
179181
</strong>
@@ -274,6 +276,7 @@ exports[`PreviewTemplateDetailsLetter matches snapshot when proofs are present,
274276
>
275277
<strong
276278
class="nhsuk-tag nhsuk-tag--orange"
279+
data-test-id="status-tag-proof-available"
277280
>
278281
Proof available
279282
</strong>
@@ -492,6 +495,7 @@ exports[`PreviewTemplateDetailsLetter matches snapshot when test data CSV is abs
492495
>
493496
<strong
494497
class="nhsuk-tag nhsuk-tag--blue"
498+
data-test-id="status-tag-pending-validation"
495499
>
496500
Checking files
497501
</strong>
@@ -592,6 +596,7 @@ exports[`PreviewTemplateDetailsLetter matches snapshot without proofs 1`] = `
592596
>
593597
<strong
594598
class="nhsuk-tag nhsuk-tag--blue"
599+
data-test-id="status-tag-pending-validation"
595600
>
596601
Checking files
597602
</strong>
@@ -727,6 +732,7 @@ exports[`PreviewTemplateDetailsNhsApp matches snapshot 1`] = `
727732
>
728733
<strong
729734
class="nhsuk-tag"
735+
data-test-id="status-tag-not-yet-submitted"
730736
>
731737
Not yet submitted
732738
</strong>
@@ -821,6 +827,7 @@ exports[`PreviewTemplateDetailsSms matches snapshot 1`] = `
821827
>
822828
<strong
823829
class="nhsuk-tag nhsuk-tag--grey"
830+
data-test-id="status-tag-submitted"
824831
>
825832
Submitted
826833
</strong>

frontend/src/__tests__/components/molecules/__snapshots__/ViewEmailTemplate.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ exports[`ViewEmailTemplate component matches submitted snapshot 1`] = `
8888
>
8989
<strong
9090
class="nhsuk-tag nhsuk-tag--grey"
91+
data-test-id="status-tag-submitted"
9192
>
9293
Submitted
9394
</strong>

frontend/src/__tests__/components/molecules/__snapshots__/ViewLetterTemplate.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ exports[`ViewLetterTemplate component matches submitted snapshot 1`] = `
8989
>
9090
<strong
9191
class="nhsuk-tag nhsuk-tag--grey"
92+
data-test-id="status-tag-submitted"
9293
>
9394
Submitted
9495
</strong>

frontend/src/__tests__/components/molecules/__snapshots__/ViewNHSAppTemplate.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ exports[`ViewNHSAppTemplate component matches submitted snapshot 1`] = `
8888
>
8989
<strong
9090
class="nhsuk-tag nhsuk-tag--grey"
91+
data-test-id="status-tag-submitted"
9192
>
9293
Submitted
9394
</strong>

0 commit comments

Comments
 (0)