Skip to content

Commit 1a0fb2a

Browse files
authored
Add tests now that footnote rendering works correctly. (#9)
1 parent 627e226 commit 1a0fb2a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/markly/renderer/html.rb

+26
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,31 @@
3939
it "can render multiple tables" do
4040
expect(renderer.render(document).scan(/<tbody>/).size).to be == 2
4141
end
42+
43+
it "generates the same output as the built in renderer" do
44+
expect(renderer.render(document)).to be == document.to_html
45+
end
46+
end
47+
48+
with "footnotes" do
49+
let(:markdown) {"Hello[^hi].\n\n[^hi]: Hey!\n"}
50+
let(:document) {Markly.parse(markdown, flags: Markly::FOOTNOTES)}
51+
52+
it "can render footnotes" do
53+
expect(renderer.render(document)).to be == <<~HTML
54+
<p>Hello<sup class="footnote-ref"><a href="#fn-hi" id="fnref-hi" data-footnote-ref>1</a></sup>.</p>
55+
<section class="footnotes" data-footnotes>
56+
<ol>
57+
<li id="fn-hi">
58+
<p>Hey! <a href="#fnref-hi" class="footnote-backref" data-footnote-backref data-footnote-backref-idx="1" aria-label="Back to reference 1"></a></p>
59+
</li>
60+
</ol>
61+
</section>
62+
HTML
63+
end
64+
65+
it "generates the same output as the built in renderer" do
66+
expect(renderer.render(document)).to be == document.to_html
67+
end
4268
end
4369
end

0 commit comments

Comments
 (0)