Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing label and legend classes to HTML fixtures #2659

Merged
merged 5 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
1 change: 1 addition & 0 deletions src/govuk/components/character-count/character-count.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ examples:
maxlength: 10
label:
text: Full address
classes: govuk-label--l
isPageHeading: true

- name: with word count
Expand Down
2 changes: 2 additions & 0 deletions src/govuk/components/checkboxes/checkboxes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ examples:
fieldset:
legend:
text: How do you want to sign in?
classes: govuk-fieldset__legend--l
isPageHeading: true
items:
- name: gateway
Expand All @@ -223,6 +224,7 @@ examples:
fieldset:
legend:
text: How do you want to sign in?
classes: govuk-fieldset__legend--l
isPageHeading: true
items:
- name: gateway
Expand Down
45 changes: 44 additions & 1 deletion src/govuk/components/fieldset/fieldset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,54 @@ examples:
data:
legend:
text: What is your address?
- name: as page heading
- name: styled as xl text
data:
legend:
text: What is your address?
classes: govuk-fieldset__legend--xl
- name: styled as large text
data:
legend:
text: What is your address?
classes: govuk-fieldset__legend--l
- name: styled as medium text
data:
legend:
text: What is your address?
classes: govuk-fieldset__legend--m
- name: styled as small text
data:
legend:
text: What is your address?
classes: govuk-fieldset__legend--s
- name: as page heading xl
data:
legend:
text: What is your address?
classes: govuk-fieldset__legend--xl
isPageHeading: true
- name: as page heading l
data:
legend:
text: What is your address?
classes: govuk-fieldset__legend--l
isPageHeading: true
- name: as page heading m
data:
legend:
text: What is your address?
classes: govuk-fieldset__legend--m
isPageHeading: true
- name: as page heading s
data:
legend:
text: What is your address?
classes: govuk-fieldset__legend--s
isPageHeading: true
- name: as page heading without class
data:
legend:
text: What is your address?
isPageHeading: true

# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/fieldset/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('fieldset', () => {
})

it('nests the legend text in an H1 if the legend is a page heading', () => {
const $ = render('fieldset', examples['as page heading'])
const $ = render('fieldset', examples['as page heading l'])

const $headingInsideLegend = $('.govuk-fieldset__legend > h1')
expect($headingInsideLegend.text().trim()).toBe('What is your address?')
Expand Down
1 change: 1 addition & 0 deletions src/govuk/components/file-upload/file-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ examples:
name: file-upload-1
label:
text: Upload a file
classes: govuk-label--l
isPageHeading: true
- name: with optional form-group classes
data:
Expand Down
1 change: 1 addition & 0 deletions src/govuk/components/input/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ examples:
data:
label:
text: National Insurance number
classes: govuk-label--l
isPageHeading: true
id: input-with-page-heading
name: test-name
Expand Down
37 changes: 36 additions & 1 deletion src/govuk/components/label/label.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,45 @@ examples:
data:
classes: govuk-label--s
text: National Insurance number
- name: as page heading
- name: styled as xl text
data:
text: National Insurance number
classes: govuk-label--xl
- name: styled as large text
data:
text: National Insurance number
classes: govuk-label--l
- name: styled as medium text
data:
text: National Insurance number
classes: govuk-label--m
- name: styled as small text
data:
text: National Insurance number
classes: govuk-label--s
- name: as page heading xl
data:
text: National Insurance number
classes: govuk-label--xl
isPageHeading: true
- name: as page heading l
data:
text: National Insurance number
classes: govuk-label--l
isPageHeading: true
- name: as page heading m
data:
text: National Insurance number
classes: govuk-label--m
isPageHeading: true
- name: as page heading s
data:
text: National Insurance number
classes: govuk-label--s
isPageHeading: true
- name: as page heading without class
data:
text: National Insurance number
isPageHeading: true

# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/label/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('Label', () => {
})

it('can be nested inside an H1 using isPageHeading', () => {
const $ = render('label', examples['as page heading'])
const $ = render('label', examples['as page heading l'])

const $selector = $('h1 > .govuk-label')
expect($selector.length).toBeTruthy()
Expand Down
2 changes: 2 additions & 0 deletions src/govuk/components/radios/radios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ examples:
fieldset:
legend:
text: How do you want to sign in?
classes: govuk-fieldset__legend--l
isPageHeading: true
items:
- value: gateway
Expand Down Expand Up @@ -220,6 +221,7 @@ examples:
fieldset:
legend:
text: How do you want to sign in?
classes: govuk-fieldset__legend--l
isPageHeading: true
items:
- value: gateway
Expand Down
1 change: 1 addition & 0 deletions src/govuk/components/select/select.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ examples:
name: select-3
label:
text: Label text goes here
classes: govuk-label--l
isPageHeading: true
items:
-
Expand Down
1 change: 1 addition & 0 deletions src/govuk/components/textarea/textarea.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ examples:
name: address
label:
text: Full address
classes: govuk-label--l
isPageHeading: true

- name: with optional form-group classes
Expand Down