diff --git a/CHANGELOG.md b/CHANGELOG.md index d5e70b83..00e943f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 8.3.1 + +* Bug fixes related to block elements in call to action and legislative list components ([#293](https://github.com/alphagov/govspeak/pull/293)) + ## 8.3.0 * Various bug fixes related to abbreviations in call to action and legislative list components ([#291](https://github.com/alphagov/govspeak/pull/291)) diff --git a/lib/govspeak.rb b/lib/govspeak.rb index 982facb1..a46b5b68 100644 --- a/lib/govspeak.rb +++ b/lib/govspeak.rb @@ -278,9 +278,7 @@ def render_image(image) extension("call-to-action", surrounded_by("$CTA")) do |body| <<~BODY - {::options parse_block_html=\"true\" /} -
Some text
+ ) + end + end + test_given_govspeak " 1. rod 2. jane @@ -1268,6 +1286,24 @@ class GovspeakTest < Minitest::Test ) end + test "LegislativeList with image" do + given_govspeak " + $LegislativeList + [Image:image-id] + $EndLegislativeList + + Some text + ", images: [build_image] do + assert_html_output %( +Some text
+ ) + end + end + test_given_govspeak " Zippy, Bungle and George did not qualify for the tax exemption in s428. They filled in their tax return accordingly. " do diff --git a/test/govspeak_test_helper.rb b/test/govspeak_test_helper.rb index 4e3c1ec3..5dc3cdfe 100644 --- a/test/govspeak_test_helper.rb +++ b/test/govspeak_test_helper.rb @@ -73,6 +73,13 @@ def deobfuscate_mailto(html) coder.decode(html) end + def build_image(attrs = {}) + attrs[:alt_text] ||= "my alt" + attrs[:url] ||= "http://example.com/image.jpg" + attrs[:id] ||= "image-id" + attrs + end + module ClassMethods def test_given_govspeak(govspeak, options = {}, &block) test "Given #{govspeak}" do