Skip to content

Commit

Permalink
Fix HTML indentation in YAML files
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Nov 20, 2023
1 parent adc3aa8 commit d863a55
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ examples:
<label class="govuk-label" for="other-country">
Country
</label>
<input class="govuk-input" id="other-country" name="other-country" type="text" value="Ravka">
<input class="govuk-input" id="other-country" name="other-country" type="text" value="Ravka">
</div>
values:
- british
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ examples:
options:
messages:
- headingHtml: Cookies on <span>my service</span>
html: <p class="govuk-body">We use cookies in <span>our service</span>.</p><p class="govuk-body">We’d like to use analytics cookies so we can understand how you use the Design System and make improvements.</p>
html: |
<p class="govuk-body">We use cookies in <span>our service</span>.</p>
<p class="govuk-body">We’d like to use analytics cookies so we can understand how you use the Design System and make improvements.</p>
actions:
- text: Accept analytics cookies
type: submit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,15 @@ examples:
text: This publication was withdrawn on 7 March 2014.
- name: paragraph as html heading
options:
html: <p class="govuk-notification-banner__heading">You have 9 days to send a response.</p>
html: |
<p class="govuk-notification-banner__heading">You have 9 days to send a response.</p>
- name: with text as html
options:
html: |
<h3 class="govuk-notification-banner__heading">This publication was withdrawn on 7 March 2014</h3><p class="govuk-body">Archived and replaced by the <a href="#" class="govuk-notification-banner__link">new planning guidance</a> launched 6 March 2014 on an external website</p>
<h3 class="govuk-notification-banner__heading">
This publication was withdrawn on 7 March 2014
</h3>
<p class="govuk-body">Archived and replaced by the <a href="#" class="govuk-notification-banner__link">new planning guidance</a> launched 6 March 2014 on an external website</p>
- name: with type as success
options:
type: success
Expand All @@ -71,34 +75,36 @@ examples:
options:
type: success
html: |
<h3 class="govuk-notification-banner__heading">4 files uploaded</h3><ul class="govuk-!-margin-0 govuk-list"><li><a href="link-1" class="govuk-notification-banner__link">government-strategy.pdf</a></li><li><a href="link-2" class="govuk-notification-banner__link">government-strategy-v1.pdf</a></li></ul>
<h3 class="govuk-notification-banner__heading">
4 files uploaded
</h3>
<ul class="govuk-!-margin-0 govuk-list">
<li><a href="link-1" class="govuk-notification-banner__link">government-strategy.pdf</a></li>
<li><a href="link-2" class="govuk-notification-banner__link">government-strategy-v1.pdf</a></li>
</ul>
- name: with a list
options:
html: |
<h3 class="govuk-notification-banner__heading">4 files uploaded</h3>
<ul class="govuk-list govuk-list--bullet govuk-!-margin-bottom-0">
<li><a href="#" class="govuk-notification-banner__link">government-strategy.pdf</a></li>
<li><a href="#" class="govuk-notification-banner__link">government-strategy-v2.pdf</a></li>
<li><a href="#" class="govuk-notification-banner__link">government-strategy-v3-FINAL.pdf</a></li>
<li><a href="#" class="govuk-notification-banner__link">government-strategy-v4-FINAL-v2.pdf</a></li>
<li><a href="#" class="govuk-notification-banner__link">government-strategy.pdf</a></li>
<li><a href="#" class="govuk-notification-banner__link">government-strategy-v2.pdf</a></li>
<li><a href="#" class="govuk-notification-banner__link">government-strategy-v3-FINAL.pdf</a></li>
<li><a href="#" class="govuk-notification-banner__link">government-strategy-v4-FINAL-v2.pdf</a></li>
</ul>
- name: with long heading
options:
text: This publication was withdrawn on 7 March 2014, before being sent in, sent back, queried, lost, found, subjected to public inquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters.
- name: with lots of content
options:
html: >
html: |
<h3 class="govuk-notification-banner__heading">
Check if you need to apply the reverse charge to this application
</h3>
<p class="govuk-body">You will have to apply the <a href="#" class="govuk-notification-banner__link">reverse charge</a> if the applicant supplies any of these services:</p>
<ul class="govuk-list govuk-list--bullet govuk-list--spaced">
<li>
constructing, altering, repairing, extending, demolishing or dismantling buildings or structures (whether permanent or not), including offshore installation services
</li>
<li>
constructing, altering, repairing, extending, demolishing of any works forming, or planned to form, part of the land, including (in particular) walls, roadworks, power lines, electronic communications equipment, aircraft runways, railways, inland waterways, docks and harbours
</li>
<li>constructing, altering, repairing, extending, demolishing or dismantling buildings or structures (whether permanent or not), including offshore installation services</li>
<li>constructing, altering, repairing, extending, demolishing of any works forming, or planned to form, part of the land, including (in particular) walls, roadworks, power lines, electronic communications equipment, aircraft runways, railways, inland waterways, docks and harbours</li>
</ul>
- name: auto-focus disabled, with type as success
options:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { render } = require('@govuk-frontend/helpers/nunjucks')
const { getExamples } = require('@govuk-frontend/lib/components')
const { outdent } = require('outdent')

describe('Notification-banner', () => {
let examples
Expand Down Expand Up @@ -198,9 +199,12 @@ describe('Notification-banner', () => {
const $ = render('notification-banner', examples['with text as html'])
const $contentHtml = $('.govuk-notification-banner__content')

expect($contentHtml.html().trim()).toEqual(
'<h3 class="govuk-notification-banner__heading">This publication was withdrawn on 7 March 2014</h3><p class="govuk-body">Archived and replaced by the <a href="#" class="govuk-notification-banner__link">new planning guidance</a> launched 6 March 2014 on an external website</p>'
)
expect($contentHtml.html().trim()).toEqual(outdent`
<h3 class="govuk-notification-banner__heading">
This publication was withdrawn on 7 March 2014
</h3>
<p class="govuk-body">Archived and replaced by the <a href="#" class="govuk-notification-banner__link">new planning guidance</a> launched 6 March 2014 on an external website</p>
`)
})
})

Expand Down

0 comments on commit d863a55

Please sign in to comment.