Skip to content

Commit

Permalink
Add single inline code toc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
minddust committed Mar 17, 2016
1 parent 56f491e commit 6a1b408
Showing 1 changed file with 33 additions and 4 deletions.
37 changes: 33 additions & 4 deletions tests/test_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,23 @@ def testAnchorLink(self):
'<h2 id="header-2"><a class="toclink" href="#header-2">Header <em>2</em></a></h2>'
)

def testAnchorLinkWithInlineCode(self):
""" Test TOC Anchorlink with inline code. """
def testAnchorLinkWithSingleInlineCode(self):
""" Test TOC Anchorlink with single inline code. """
md = markdown.Markdown(
extensions=[markdown.extensions.toc.TocExtension(anchorlink=True)]
)
text = '# This is `code`.'
self.assertEqual(
md.convert(text),
'<h1 id="this-is-code">' # noqa
'<a class="toclink" href="#this-is-code">' # noqa
'This is <code>code</code>.' # noqa
'</a>' # noqa
'</h1>' # noqa
)

def testAnchorLinkWithDoubleInlineCode(self):
""" Test TOC Anchorlink with double inline code. """
md = markdown.Markdown(
extensions=[markdown.extensions.toc.TocExtension(anchorlink=True)]
)
Expand Down Expand Up @@ -804,8 +819,22 @@ def testPermalink(self):
'</h1>' # noqa
)

def testPermalinkWithInlineCode(self):
""" Test TOC Permalink with inline code. """
def testPermalinkWithSingleInlineCode(self):
""" Test TOC Permalink with single inline code. """
md = markdown.Markdown(
extensions=[markdown.extensions.toc.TocExtension(permalink=True)]
)
text = '# This is `code`.'
self.assertEqual(
md.convert(text),
'<h1 id="this-is-code">' # noqa
'This is <code>code</code>.' # noqa
'<a class="headerlink" href="#this-is-code" title="Permanent link">&para;</a>' # noqa
'</h1>' # noqa
)

def testPermalinkWithDoubleInlineCode(self):
""" Test TOC Permalink with double inline code. """
md = markdown.Markdown(
extensions=[markdown.extensions.toc.TocExtension(permalink=True)]
)
Expand Down

0 comments on commit 6a1b408

Please sign in to comment.