From 56f491eeeeddb9651d68a0fd6d21aac139abca52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Gro=C3=9F?= Date: Thu, 17 Mar 2016 15:32:57 +0000 Subject: Add toc permalink tests --- tests/test_extensions.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_extensions.py b/tests/test_extensions.py index a5b739e..7a18b94 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -790,6 +790,34 @@ class TestTOC(TestCaseWithAssertStartsWith): '' # noqa ) + def testPermalink(self): + """ Test TOC Permalink. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(permalink=True)] + ) + text = '# Header' + self.assertEqual( + md.convert(text), + '

' # noqa + 'Header' # noqa + '' # noqa + '

' # noqa + ) + + def testPermalinkWithInlineCode(self): + """ Test TOC Permalink with inline code. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(permalink=True)] + ) + text = '# This is `code` and `this` too.' + self.assertEqual( + md.convert(text), + '

' # noqa + 'This is code and this too.' # noqa + '' # noqa + '

' # noqa + ) + def testTitle(self): """ Test TOC Title. """ md = markdown.Markdown( -- cgit v1.2.3