aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Groß <stephan@minddust.com>2016-03-17 16:00:01 +0000
committerStephan Groß <stephan@minddust.com>2016-03-17 16:00:01 +0000
commit6a1b408f82d6c7e59730a4641554bdcab492eb21 (patch)
tree0d1961e8accbdfaf80e760e774433360aff1828b
parent56f491eeeeddb9651d68a0fd6d21aac139abca52 (diff)
downloadmarkdown-6a1b408f82d6c7e59730a4641554bdcab492eb21.tar.gz
markdown-6a1b408f82d6c7e59730a4641554bdcab492eb21.tar.bz2
markdown-6a1b408f82d6c7e59730a4641554bdcab492eb21.zip
Add single inline code toc tests
-rw-r--r--tests/test_extensions.py37
1 files changed, 33 insertions, 4 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index 7a18b94..19a1389 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -775,8 +775,23 @@ class TestTOC(TestCaseWithAssertStartsWith):
'<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)]
)
@@ -804,8 +819,22 @@ class TestTOC(TestCaseWithAssertStartsWith):
'</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)]
)