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

Fix classes on character count when in error state #1631

Merged
merged 1 commit into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ You can now set attributes in the `<body>` element of page template.
### Fixes
- [Pull request #1620: Only add underline to back link when href exists ](https://github.com/alphagov/govuk-frontend/pull/1620).
- [Pull request #1609: Update hex value for secondary text to improve contrast](https://github.com/alphagov/govuk-frontend/pull/1609)
- [Pull request #1631: Fix classes on character count when in error state](https://github.com/alphagov/govuk-frontend/pull/1631)

## 3.3.0 (Feature release)

Expand Down
2 changes: 1 addition & 1 deletion src/govuk/components/character-count/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
rows: params.rows,
value: params.value,
formGroup: params.formGroup,
classes: 'govuk-js-character-count ' + (' govuk-textarea--error' if params.errorMessage) + (params.classes if params.classes),
classes: 'govuk-js-character-count' + (' govuk-textarea--error' if params.errorMessage) + (' ' + params.classes if params.classes),
label: {
html: params.label.html,
text: params.label.text,
Expand Down
12 changes: 12 additions & 0 deletions src/govuk/components/character-count/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ describe('Character count', () => {
const $component = $('.govuk-js-character-count')
expect($component.hasClass('govuk-textarea--error')).toBeTruthy()
})

it('renders with classes', () => {
const $ = render('character-count', {
errorMessage: {
text: 'Error message'
},
classes: 'app-character-count--custom-modifier'
})

const $component = $('.govuk-js-character-count')
expect($component.hasClass('app-character-count--custom-modifier')).toBeTruthy()
})
})

describe('with dependant components', () => {
Expand Down