Skip to content

Commit

Permalink
Fix for abbreviations nested in button
Browse files Browse the repository at this point in the history
  • Loading branch information
baisa committed Jan 6, 2023
1 parent 64127da commit 48c63f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/govspeak/post_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def self.extension(title, &block)
document.css(".govuk-button").map do |el|
button_html = GovukPublishingComponents.render(
"govuk_publishing_components/components/button",
text: el.inner_html,
text: el.inner_html.html_safe,
href: el["href"],
start: el["data-start"],
data_attributes: {
Expand Down
11 changes: 11 additions & 0 deletions test/govspeak_button_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,15 @@ class GovspeakTest < Minitest::Test
lorem lorem lorem</p>
)
end

test_given_govspeak "
{button start}[Start now JSA](https://www.apply-for-new-style-jsa.dwp.gov.uk/?lang=cy){/button}
\n\n
*[JSA]: Jobseeker's Allowance
" do
assert_text_output "Start now JSA"
assert_html_output %(
<p><a class="gem-c-button govuk-button govuk-button--start" role="button" data-module="govuk-button" draggable="false" href="https://www.apply-for-new-style-jsa.dwp.gov.uk/?lang=cy"> Start now <abbr title="Jobseeker's Allowance">JSA</abbr><svg class="govuk-button__start-icon govuk-!-display-none-print" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewbox="0 0 33 40" focusable="false" aria-hidden="true"><path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z"></path></svg></a></p>
)
end
end

0 comments on commit 48c63f6

Please sign in to comment.