aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2014-12-30 11:00:27 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2014-12-30 11:00:27 -0500
commit182a26caa7185ba3d951526c6dd19c1f32a1688a (patch)
treeabe0b0819b1dbc0ee03350d549b86d77ba773593 /tests
parent257c0fe9aad40879ebe9b6e84613d5c3a5adf2b5 (diff)
downloadmarkdown-182a26caa7185ba3d951526c6dd19c1f32a1688a.tar.gz
markdown-182a26caa7185ba3d951526c6dd19c1f32a1688a.tar.bz2
markdown-182a26caa7185ba3d951526c6dd19c1f32a1688a.zip
Add reset support to TOC extension.
Now, whenever the TOC extensiuon is loaded, the Markdown class instance will always have a toc attribute (md.toc). Calling md.reset() will also reset the toc attribute which defaults to an empty string.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_extensions.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index e24118f..760069f 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -733,6 +733,25 @@ class TestTOC(unittest.TestCase):
'</div>\n'
)
+ def testReset(self):
+ """ Test TOC Reset. """
+ self.assertEqual(self.md.toc, '')
+ self.md.convert('# Header 1\n\n## Header 2')
+ self.assertEqual(
+ self.md.toc,
+ '<div class="toc">\n'
+ '<ul>\n' # noqa
+ '<li><a href="#header-1">Header 1</a>' # noqa
+ '<ul>\n' # noqa
+ '<li><a href="#header-2">Header 2</a></li>\n' # noqa
+ '</ul>\n' # noqa
+ '</li>\n' # noqa
+ '</ul>\n' # noqa
+ '</div>\n'
+ )
+ self.md.reset()
+ self.assertEqual(self.md.toc, '')
+
class TestSmarty(unittest.TestCase):
def setUp(self):