Skip to content

Commit 290dc5a

Browse files
authored
Merge pull request #6079 from alphagov/form-inputs-examples
Update examples for form input components
2 parents 9afdcac + 372a187 commit 290dc5a

13 files changed

Lines changed: 588 additions & 789 deletions

File tree

packages/govuk-frontend/src/govuk/components/character-count/character-count.yaml

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,6 @@ examples:
143143
label:
144144
text: Can you provide more detail?
145145

146-
- name: with custom textarea description
147-
description: with textarea description translated into Welsh.
148-
options:
149-
name: custom-textarea-description
150-
id: custom-textarea-description
151-
maxlength: 10
152-
label:
153-
text: Can you provide more detail?
154-
textareaDescriptionText: Gallwch ddefnyddio hyd at %{count} nod
155-
156146
- name: with hint
157147
options:
158148
name: with-hint
@@ -164,16 +154,6 @@ examples:
164154
text: Don't include personal or financial information, eg your
165155
National Insurance number or credit card details.
166156

167-
- name: with error
168-
options:
169-
name: with-error
170-
id: with-error
171-
maxlength: 10
172-
label:
173-
text: Can you provide more detail?
174-
errorMessage:
175-
text: Please provide more detail
176-
177157
- name: with hint and error
178158
options:
179159
name: with-error
@@ -249,29 +229,17 @@ examples:
249229
label:
250230
text: Full address
251231

252-
- name: with translations
232+
# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
233+
- name: with custom textarea description
234+
hidden: true
235+
description: with textarea description translated into Welsh.
253236
options:
254-
id: with-translations
255-
name: with-translations
237+
name: custom-textarea-description
238+
id: custom-textarea-description
256239
maxlength: 10
257240
label:
258-
text: Full address
259-
charactersUnderLimitText:
260-
other: '%{count} characters to go'
261-
one: 'One character to go'
262-
charactersAtLimitText: 'Zero characters left'
263-
charactersOverLimitText:
264-
other: '%{count} characters too many'
265-
one: 'One character too many'
266-
wordsUnderLimitText:
267-
other: '%{count} words to go'
268-
one: 'One word to go'
269-
wordsAtLimitText: 'Zero words left'
270-
wordsOverLimitText:
271-
other: '%{count} words too many'
272-
one: 'One word too many'
273-
274-
# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
241+
text: Can you provide more detail?
242+
textareaDescriptionText: Gallwch ddefnyddio hyd at %{count} nod
275243
- name: classes
276244
hidden: true
277245
options:
@@ -396,3 +364,25 @@ examples:
396364
name: no-maximum
397365
label:
398366
text: Full address
367+
- name: with translations
368+
hidden: true
369+
options:
370+
id: with-translations
371+
name: with-translations
372+
maxlength: 10
373+
label:
374+
text: Full address
375+
charactersUnderLimitText:
376+
other: '%{count} characters to go'
377+
one: 'One character to go'
378+
charactersAtLimitText: 'Zero characters left'
379+
charactersOverLimitText:
380+
other: '%{count} characters too many'
381+
one: 'One character too many'
382+
wordsUnderLimitText:
383+
other: '%{count} words to go'
384+
one: 'One word to go'
385+
wordsAtLimitText: 'Zero words left'
386+
wordsOverLimitText:
387+
other: '%{count} words too many'
388+
one: 'One word too many'

packages/govuk-frontend/src/govuk/components/checkboxes/checkboxes.puppeteer.test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ describe('Checkboxes', () => {
9090
let $inputs
9191

9292
beforeAll(async () => {
93-
await render(
94-
page,
95-
'checkboxes',
96-
examples['with conditional item checked']
97-
)
93+
await render(page, 'checkboxes', examples['with pre-checked values'])
9894

9995
$component = await page.$('.govuk-checkboxes')
10096
$inputs = await $component.$$('.govuk-checkboxes__input')
@@ -111,7 +107,7 @@ describe('Checkboxes', () => {
111107
})
112108

113109
it('has no conditional content revealed that is associated with an unchecked input', async () => {
114-
const $input = $inputs[$inputs.length - 1] // Last input, unchecked
110+
const $input = $inputs[1] // second input, unchecked
115111
const $conditional = await $component.$(
116112
`[id="${await getAttribute($input, 'aria-controls')}"]`
117113
)

0 commit comments

Comments
 (0)