From 50ea909aab8ee7f530a0309f11a17efdcc2c66ed Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Mon, 21 May 2018 18:06:19 +0100 Subject: [PATCH 1/3] Fix body element rendering with no text Fixes #558 --- src/components/panel/template.njk | 2 ++ src/components/panel/template.test.js | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/components/panel/template.njk b/src/components/panel/template.njk index 11183ade59..6744f31b86 100644 --- a/src/components/panel/template.njk +++ b/src/components/panel/template.njk @@ -4,7 +4,9 @@

{{ params.titleHtml | safe if params.titleHtml else params.titleText }}

+ {% if params.html or params.text %}
{{ params.html | safe if params.html else params.text }}
+ {% endif %} diff --git a/src/components/panel/template.test.js b/src/components/panel/template.test.js index 0067ab4e83..290baf2c62 100644 --- a/src/components/panel/template.test.js +++ b/src/components/panel/template.test.js @@ -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() + }) }) From 723e0724e43dacbc71d37d869034cff1898522be Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Mon, 21 May 2018 18:08:22 +0100 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cae00d854..3094f3270f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) From a51af37f3a10b91349f3724196bff3fc8e2f5386 Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Tue, 22 May 2018 11:49:57 +0100 Subject: [PATCH 3/3] Update Panel README --- src/components/panel/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/panel/README.md b/src/components/panel/README.md index 99fbb6c17b..c9dbab2cc9 100644 --- a/src/components/panel/README.md +++ b/src/components/panel/README.md @@ -20,9 +20,11 @@ Find out when to use the Panel component in your service in the [GOV.UK Design S

Application complete

+
Your reference number: HDJ2123F
+ #### Macro