Skip to content

Commit

Permalink
Add test for previously problematic scenario
Browse files Browse the repository at this point in the history
In a previous Zendesk ticket
(https://govuk.zendesk.com/agent/tickets/4819383), a problem was
reported where abbreviations within HTML tag elements were being
replaced with abbreviation tags.

The fix at the time was to revert the code for adding abbreviations to
legislative lists and calls to action.

This adds a test for the previously problematic scenario, so we can
implement the abbreviations functionality again in a later commit.
  • Loading branch information
brucebolt committed Aug 21, 2023
1 parent 9ca47bb commit fdd5598
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions test/govspeak_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -624,15 +624,15 @@ class GovspeakTest < Minitest::Test

test_given_govspeak "
$CTA
Contact the SGD on 0800 000 0000 or contact the OGD on 0800 001 0001
Contact the SGD on 0800 000 0000 or contact the class on 0800 001 0001
$CTA
*[OGD]: Other Government Department
*[class]: Other Government Department
*[SGD]: Some Government Department
" do
assert_html_output %(
<div class="call-to-action">
<p>Contact the <abbr title="Some Government Department">SGD</abbr> on 0800 000 0000 or contact the <abbr title="Other Government Department">OGD</abbr> on 0800 001 0001</p>
<p>Contact the <abbr title="Some Government Department">SGD</abbr> on 0800 000 0000 or contact the <abbr title="Other Government Department">class</abbr> on 0800 001 0001</p>
</div>
)
end
Expand Down Expand Up @@ -1109,21 +1109,24 @@ class GovspeakTest < Minitest::Test
$LegislativeList
* 1. Item 1[^1] with an ACRONYM
* 2. Item 2[^2]
* 3. Item 3
* 3. Item 3[^3]
$EndLegislativeList
[^1]: Footnote definition one
[^2]: Footnote definition two with an ACRONYM
[^3]: Footnote definition three with an acronym that matches an HTML tag class
*[ACRONYM]: This is the acronym explanation
*[class]: Testing HTML matching
" do
assert_html_output %(
<ol class="legislative-list">
<li>1. Item 1<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">[footnote 1]</a></sup> with an <abbr title="This is the acronym explanation">ACRONYM</abbr>
</li>
<li>2. Item 2<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">[footnote 2]</a></sup>
</li>
<li>3. Item 3</li>
<li>3. Item 3<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">[footnote 3]</a></sup>
</li>
</ol>
<div class="footnotes" role="doc-endnotes">
Expand All @@ -1137,6 +1140,11 @@ class GovspeakTest < Minitest::Test
<p>
Footnote definition two with an <abbr title="This is the acronym explanation">ACRONYM</abbr><a href="#fnref:2" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
</p>
</li>
<li id="fn:3" role="doc-endnote">
<p>
Footnote definition three with an acronym that matches an HTML tag <abbr title="Testing HTML matching">class</abbr><a href="#fnref:3" class="reversefootnote" role="doc-backlink" aria-label="go to where this is referenced">↩</a>
</p>
</li>
</ol>
</div>
Expand Down

0 comments on commit fdd5598

Please sign in to comment.