From ede69aee2e53cd2eb2c960dc3ecba2d423faac82 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Tue, 30 Dec 2014 12:02:35 -0500 Subject: Complete test coverage of TOC Extension --- tests/test_extensions.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'tests') diff --git a/tests/test_extensions.py b/tests/test_extensions.py index 2380f17..dae8829 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -741,6 +741,48 @@ class TestTOC(unittest.TestCase): self.md.reset() self.assertEqual(self.md.toc, '') + def testAnchorLink(self): + """ Test TOC Anchorlink. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(anchorlink=True)] + ) + text = '# Header 1\n\n## Header *2*' + self.assertEqual( + md.convert(text), + '

Header 1

\n' + '

Header 2

' + ) + + def testTitle(self): + """ Test TOC Title. """ + md = markdown.Markdown( + extensions=[markdown.extensions.toc.TocExtension(title='Table of Contents')] + ) + md.convert('# Header 1\n\n## Header 2') + self.assertTrue(md.toc.startswith('
Table of Contents