Skip to content

Commit

Permalink
Add test for inline links in numbered lists
Browse files Browse the repository at this point in the history
This test currently fails as links are not supported in numbered lists.
  • Loading branch information
brucebolt committed Aug 1, 2023
1 parent c893c09 commit baf3f66
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/govspeak_attachment_link_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,28 @@ def render_govspeak(govspeak, attachments = [])
rendered = render_govspeak("[AttachmentLink: This is the name of my &%$@€? attachment]", [attachment])
assert_match(/Attachment Title/, rendered)
end

test "renders an attachment link inside a numbered list" do
attachment = {
id: "attachment.pdf",
url: "http://example.com/attachment.pdf",
title: "Attachment Title",
}

rendered = render_govspeak("s1. First item with [AttachmentLink: attachment.pdf]\ns2. Second item without attachment", [attachment])

expected_output = <<~TEXT
<ol class="steps">
<li>
<p>First item with <span class="gem-c-attachment-link">
<a class="govuk-link" href="http://example.com/attachment.pdf">Attachment Title</a> </span></p>
</li>
<li>
<p>Second item without attachment</p>
</li>
</ol>
TEXT

assert_equal(expected_output, rendered)
end
end

0 comments on commit baf3f66

Please sign in to comment.