Skip to content

Commit 029fa95

Browse files
Merge pull request #43 from DEFRA/dependabot/npm_and_yarn/defra/forms-model-3.0.435
Dependabot/npm and yarn/defra/forms model 3.0.435
2 parents 45e9640 + 3db265f commit 029fa95

File tree

13 files changed

+133
-89
lines changed

13 files changed

+133
-89
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
},
6161
"license": "SEE LICENSE IN LICENSE",
6262
"dependencies": {
63-
"@defra/forms-model": "^3.0.432",
63+
"@defra/forms-model": "^3.0.438",
6464
"@defra/hapi-tracing": "^1.0.0",
6565
"@elastic/ecs-pino-format": "^1.5.0",
6666
"@hapi/boom": "^10.0.1",

src/server/plugins/engine/components/AutocompleteField.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe.each([
172172

173173
describe('State', () => {
174174
it.each([...options.examples])('returns text from state', (item) => {
175-
const state1 = getFormState(item.state)
175+
const state1 = getFormState(item.value)
176176
const state2 = getFormState(null)
177177

178178
const answer1 = getAnswer(field, state1)
@@ -183,7 +183,7 @@ describe.each([
183183
})
184184

185185
it.each([...options.examples])('returns payload from state', (item) => {
186-
const state1 = getFormState(item.state)
186+
const state1 = getFormState(item.value)
187187
const state2 = getFormState(null)
188188

189189
const payload1 = field.getFormDataFromState(state1)
@@ -194,7 +194,7 @@ describe.each([
194194
})
195195

196196
it.each([...options.examples])('returns value from state', (item) => {
197-
const state1 = getFormState(item.state)
197+
const state1 = getFormState(item.value)
198198
const state2 = getFormState(null)
199199

200200
const value1 = field.getFormValueFromState(state1)
@@ -207,7 +207,7 @@ describe.each([
207207
it.each([...options.examples])(
208208
'returns context for conditions and form submission',
209209
(item) => {
210-
const state1 = getFormState(item.state)
210+
const state1 = getFormState(item.value)
211211
const state2 = getFormState(null)
212212

213213
const value1 = field.getContextValueFromState(state1)
@@ -225,7 +225,7 @@ describe.each([
225225
const value1 = field.getStateFromValidForm(payload1)
226226
const value2 = field.getStateFromValidForm(payload2)
227227

228-
expect(value1).toEqual(getFormState(item.state))
228+
expect(value1).toEqual(getFormState(item.value))
229229
expect(value2).toEqual(getFormState(null))
230230
})
231231
})

src/server/plugins/engine/components/CheckboxesField.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ describe.each([
240240
it.each([...options.examples])(
241241
'returns text from state (single)',
242242
(item) => {
243-
const state1 = getFormState([item.state])
243+
const state1 = getFormState([item.value])
244244
const state2 = getFormState(null)
245245

246246
const answer1 = getAnswer(field, state1)
@@ -260,7 +260,7 @@ describe.each([
260260
const item1 = options.examples[0]
261261
const item2 = options.examples[2]
262262

263-
const state = getFormState([item1.state, item2.state])
263+
const state = getFormState([item1.value, item2.value])
264264
const answer = getAnswer(field, state)
265265

266266
expect(answer).toBe(outdent`
@@ -272,7 +272,7 @@ describe.each([
272272
})
273273

274274
it.each([...options.examples])('returns payload from state', (item) => {
275-
const state1 = getFormState([item.state])
275+
const state1 = getFormState([item.value])
276276
const state2 = getFormState(null)
277277

278278
const payload1 = field.getFormDataFromState(state1)
@@ -283,7 +283,7 @@ describe.each([
283283
})
284284

285285
it.each([...options.examples])('returns value from state', (item) => {
286-
const state1 = getFormState([item.state])
286+
const state1 = getFormState([item.value])
287287
const state2 = getFormState(null)
288288

289289
const value1 = field.getFormValueFromState(state1)
@@ -296,13 +296,13 @@ describe.each([
296296
it.each([...options.examples])(
297297
'returns context for conditions and form submission',
298298
(item) => {
299-
const state1 = getFormState([item.state])
299+
const state1 = getFormState([item.value])
300300
const state2 = getFormState(null)
301301

302302
const value1 = field.getContextValueFromState(state1)
303303
const value2 = field.getContextValueFromState(state2)
304304

305-
expect(value1).toEqual([item.state])
305+
expect(value1).toEqual([item.value])
306306
expect(value2).toEqual([])
307307
}
308308
)
@@ -314,7 +314,7 @@ describe.each([
314314
const value1 = field.getStateFromValidForm(payload1)
315315
const value2 = field.getStateFromValidForm(payload2)
316316

317-
expect(value1).toEqual(getFormState([item.state]))
317+
expect(value1).toEqual(getFormState([item.value]))
318318
expect(value2).toEqual(getFormState(null))
319319
})
320320
})

src/server/plugins/engine/components/List.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,21 @@ describe('List', () => {
5252
it('returns list items', () => {
5353
expect(guidance).toHaveProperty('items', [
5454
{
55+
id: '52fc51fc-c75a-4b08-9c9e-6bd99b9bc49b',
5556
text: '1 day',
5657
value: 1,
5758
description:
5859
'Valid for 24 hours from the start time that you select'
5960
},
6061
{
62+
id: '56b7b34f-23b3-4446-ac8e-b2443d18588e',
6163
text: '8 day',
6264
value: 8,
6365
description:
6466
'Valid for 8 consecutive days from the start time that you select'
6567
},
6668
{
69+
id: '1af54fbc-eec2-4e1e-bd53-2415abf62677',
6770
text: '12 months',
6871
value: 365,
6972
description:

src/server/plugins/engine/components/RadiosField.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ describe.each([
170170

171171
describe('State', () => {
172172
it.each([...options.examples])('returns text from state', (item) => {
173-
const state1 = getFormState(item.state)
173+
const state1 = getFormState(item.value)
174174
const state2 = getFormState(null)
175175

176176
const answer1 = getAnswer(field, state1)
@@ -181,7 +181,7 @@ describe.each([
181181
})
182182

183183
it.each([...options.examples])('returns payload from state', (item) => {
184-
const state1 = getFormState(item.state)
184+
const state1 = getFormState(item.value)
185185
const state2 = getFormState(null)
186186

187187
const payload1 = field.getFormDataFromState(state1)
@@ -192,7 +192,7 @@ describe.each([
192192
})
193193

194194
it.each([...options.examples])('returns value from state', (item) => {
195-
const state1 = getFormState(item.state)
195+
const state1 = getFormState(item.value)
196196
const state2 = getFormState(null)
197197

198198
const value1 = field.getFormValueFromState(state1)
@@ -205,7 +205,7 @@ describe.each([
205205
it.each([...options.examples])(
206206
'returns context for conditions and form submission',
207207
(item) => {
208-
const state1 = getFormState(item.state)
208+
const state1 = getFormState(item.value)
209209
const state2 = getFormState(null)
210210

211211
const value1 = field.getContextValueFromState(state1)
@@ -223,7 +223,7 @@ describe.each([
223223
const value1 = field.getStateFromValidForm(payload1)
224224
const value2 = field.getStateFromValidForm(payload2)
225225

226-
expect(value1).toEqual(getFormState(item.state))
226+
expect(value1).toEqual(getFormState(item.value))
227227
expect(value2).toEqual(getFormState(null))
228228
})
229229
})

src/server/plugins/engine/components/SelectField.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ describe.each([
171171

172172
describe('State', () => {
173173
it.each([...options.examples])('returns text from state', (item) => {
174-
const state1 = getFormState(item.state)
174+
const state1 = getFormState(item.value)
175175
const state2 = getFormState(null)
176176

177177
const answer1 = getAnswer(field, state1)
@@ -182,7 +182,7 @@ describe.each([
182182
})
183183

184184
it.each([...options.examples])('returns payload from state', (item) => {
185-
const state1 = getFormState(item.state)
185+
const state1 = getFormState(item.value)
186186
const state2 = getFormState(null)
187187

188188
const payload1 = field.getFormDataFromState(state1)
@@ -193,7 +193,7 @@ describe.each([
193193
})
194194

195195
it.each([...options.examples])('returns value from state', (item) => {
196-
const state1 = getFormState(item.state)
196+
const state1 = getFormState(item.value)
197197
const state2 = getFormState(null)
198198

199199
const value1 = field.getFormValueFromState(state1)
@@ -206,7 +206,7 @@ describe.each([
206206
it.each([...options.examples])(
207207
'returns context for conditions and form submission',
208208
(item) => {
209-
const state1 = getFormState(item.state)
209+
const state1 = getFormState(item.value)
210210
const state2 = getFormState(null)
211211

212212
const value1 = field.getContextValueFromState(state1)
@@ -224,7 +224,7 @@ describe.each([
224224
const value1 = field.getStateFromValidForm(payload1)
225225
const value2 = field.getStateFromValidForm(payload2)
226226

227-
expect(value1).toEqual(getFormState(item.state))
227+
expect(value1).toEqual(getFormState(item.value))
228228
expect(value2).toEqual(getFormState(null))
229229
})
230230
})

src/server/plugins/engine/pageControllers/QuestionPageController.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,13 +443,15 @@ describe('QuestionPageController', () => {
443443
expect(filtered[1].model.label?.text).toBe('Select from the list')
444444
expect(filtered[1].model.items).toEqual([
445445
{
446+
id: expect.any(String),
446447
checked: false,
447448
condition: 'isBarnOwl',
448449
selected: false,
449450
text: 'Option 1',
450451
value: '1'
451452
},
452453
{
454+
id: expect.any(String),
453455
checked: false,
454456
condition: 'isBarnOwl',
455457
selected: false,
@@ -499,13 +501,15 @@ describe('QuestionPageController', () => {
499501
expect(filtered[1].model.label?.text).toBe('Select from the list')
500502
expect(filtered[1].model.items).toEqual([
501503
{
504+
id: expect.any(String),
502505
checked: false,
503506
condition: 'notBarnOwl',
504507
selected: false,
505508
text: 'Option 3',
506509
value: '3'
507510
},
508511
{
512+
id: expect.any(String),
509513
checked: false,
510514
condition: 'notBarnOwl',
511515
selected: false,

test/condition/checkboxes.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('Checkboxes based conditions', () => {
7070
})
7171

7272
expect($checkbox).toBeInTheDocument()
73-
expect($checkbox).toHaveAttribute('id', example.id)
73+
expect($checkbox).toHaveAttribute('id', expect.any(String)) // id is now a uuid
7474
expect($checkbox).toHaveAttribute('name', example.name)
7575
expect($checkbox).toHaveAttribute('value', example.value)
7676
expect($checkbox).toHaveClass('govuk-checkboxes__input')

test/condition/radios.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('Radio based conditions', () => {
7070
})
7171

7272
expect($radio).toBeInTheDocument()
73-
expect($radio).toHaveAttribute('id', example.id)
73+
expect($radio).toHaveAttribute('id', expect.any(String)) // is now a uuid
7474
expect($radio).toHaveAttribute('name', example.name)
7575
expect($radio).toHaveAttribute('value', example.value)
7676
expect($radio).toHaveClass('govuk-radios__input')

0 commit comments

Comments
 (0)