Skip to content

Commit

Permalink
Test that new permalink renderers support HTML symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriangalliat committed Jun 19, 2021
1 parent 666dd63 commit 4371f4b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,32 @@ strictEqual(
'<h1 id="h1" tabindex="-1">H1 <a class="header-anchor" href="#h1" aria-hidden="true">#</a></h1>\n'
)

strictEqual(
md().use(anchor, {
permalink: anchor.permalink.ariaHidden({
symbol: '<i class="icon"></i>'
})
}).render('# H1'),
'<h1 id="h1" tabindex="-1">H1 <a class="header-anchor" href="#h1" aria-hidden="true"><i class="icon"></i></a></h1>\n'
)

strictEqual(
md().use(anchor, { permalink: anchor.permalink.headerLink() }).render('# H1'),
'<h1 id="h1" tabindex="-1"><a class="header-anchor" href="#h1">H1</a></h1>\n'
)

strictEqual(
md().use(anchor, {
permalink: anchor.permalink.linkAfterHeader({
symbol: '<i class="icon"></i>',
style: 'visually-hidden',
assistiveText: title => `Permalink to “${title}”`,
visuallyHiddenClass: 'visually-hidden'
})
}).render('# H1'),
'<h1 id="h1" tabindex="-1">H1</h1>\n<a class="header-anchor" href="#h1"><span class="visually-hidden">Permalink to “H1”</span> <span aria-hidden="true"><i class="icon"></i></span></a>'
)

strictEqual(
md().use(anchor, {
permalink: anchor.permalink.linkAfterHeader({
Expand Down

0 comments on commit 4371f4b

Please sign in to comment.