Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Add tests for handling of laziness
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 16, 2021
1 parent 49519e3 commit de6c2a9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,42 @@ test('markdown -> html (micromark)', (t) => {
'should support correctly number inline footnotes after calls'
)

t.deepEqual(
micromark('[^1].\n\n[^1]: a\nb', {
extensions: [syntax({inlineNotes: true})],
htmlExtensions: [html]
}),
'<p><a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>.</p>\n<section class="footnotes" role="doc-endnotes">\n<hr />\n<ol>\n<li id="fn1" role="doc-endnote">\n<p>a\nb<a href="#fnref1" class="footnote-back" role="doc-backlink">↩</a></p>\n</li>\n</ol>\n</section>',
'should support lazyness (1)'
)

t.deepEqual(
micromark('[^1].\n\n> [^1]: a\nb', {
extensions: [syntax({inlineNotes: true})],
htmlExtensions: [html]
}),
'<p><a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>.</p>\n<blockquote>\n</blockquote>\n<section class="footnotes" role="doc-endnotes">\n<hr />\n<ol>\n<li id="fn1" role="doc-endnote">\n<p>a\nb<a href="#fnref1" class="footnote-back" role="doc-backlink">↩</a></p>\n</li>\n</ol>\n</section>',
'should support lazyness (2)'
)

t.deepEqual(
micromark('[^1].\n\n> [^1]: a\n> b', {
extensions: [syntax({inlineNotes: true})],
htmlExtensions: [html]
}),
'<p><a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>.</p>\n<blockquote>\n</blockquote>\n<section class="footnotes" role="doc-endnotes">\n<hr />\n<ol>\n<li id="fn1" role="doc-endnote">\n<p>a\nb<a href="#fnref1" class="footnote-back" role="doc-backlink">↩</a></p>\n</li>\n</ol>\n</section>',
'should support lazyness (3)'
)

t.deepEqual(
micromark('[^1].\n\n[^1]: a\n\n > b', {
extensions: [syntax({inlineNotes: true})],
htmlExtensions: [html]
}),
'<p><a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a>.</p>\n<section class="footnotes" role="doc-endnotes">\n<hr />\n<ol>\n<li id="fn1" role="doc-endnote">\n<p>a</p>\n<blockquote>\n<p>b</p>\n</blockquote>\n<a href="#fnref1" class="footnote-back" role="doc-backlink">↩</a>\n</li>\n</ol>\n</section>',
'should support lazyness (4)'
)

t.end()
})

Expand Down

0 comments on commit de6c2a9

Please sign in to comment.