Skip to content

Commit

Permalink
Merge pull request #2659 from alphagov/add-label-classes
Browse files Browse the repository at this point in the history
Add missing label and legend classes to HTML fixtures
  • Loading branch information
Vanita Barrett-Smith authored Jun 14, 2022
2 parents 237a2d0 + c6e81cf commit d1b24d7
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ We’ve made fixes to GOV.UK Frontend in the following pull requests:
- [#2640: Add top padding to accordion section](https://github.com/alphagov/govuk-frontend/pull/2640)
- [#2644: Allow users to use require.resolve to import GOV.UK Frontend JavaScript](https://github.com/alphagov/govuk-frontend/pull/2644)
- [#2647: Allow users to import sass files via Webpack sass-loader](https://github.com/alphagov/govuk-frontend/pull/2647)
- [#2659: Add missing label and legend classes to HTML fixtures](https://github.com/alphagov/govuk-frontend/pull/2659)

## 4.1.0 (Feature release)

Expand Down
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

0 comments on commit d1b24d7

Please sign in to comment.