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 body element rendering with no text #707

Merged
merged 3 commits into from
May 22, 2018
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Fixes:
- Update component readme files content
([PR #704](https://github.com/alphagov/govuk-frontend/pull/704))

- Fix body element rendering with no text
([PR #707](https://github.com/alphagov/govuk-frontend/pull/707))

New features:

- Add override classes to set `display` property to `block`, `inline` and `inline-block` (PR [#694](https://github.com/alphagov/govuk-frontend/pull/654))
Expand Down
2 changes: 2 additions & 0 deletions src/components/panel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ Find out when to use the Panel component in your service in the [GOV.UK Design S
<h2 class="govuk-panel__title">
Application complete
</h2>

<div class="govuk-panel__body">
Your reference number: HDJ2123F
</div>

</div>

#### Macro
Expand Down
2 changes: 2 additions & 0 deletions src/components/panel/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<h2 class="govuk-panel__title">
{{ params.titleHtml | safe if params.titleHtml else params.titleText }}
</h2>
{% if params.html or params.text %}
<div class="govuk-panel__body">
{{ params.html | safe if params.html else params.text }}
</div>
{% endif %}
</div>
9 changes: 9 additions & 0 deletions src/components/panel/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,13 @@ describe('Panel', () => {
expect($component.attr('first-attribute')).toEqual('true')
expect($component.attr('second-attribute')).toEqual('false')
})

it('doesnt render panel body if no body text is passed', () => {
const $ = render('panel', {
titleText: 'Application complete'
})
const panelBody = $('.govuk-panel__body').length

expect(panelBody).toBeFalsy()
})
})