diff options
author | Jannis Vajen <jvajen@gmail.com> | 2022-05-05 21:53:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 15:53:38 -0400 |
commit | 93d17b9cc4a3f53dc2059e44a691a28797422d21 (patch) | |
tree | 208bcc0ef29db5f4125bbaf2fa6ef7fd054c7ffe /tests/test_syntax/extensions/test_toc.py | |
parent | efec51ac92059fc5b72f08832b481919a3ded6f3 (diff) | |
download | python-markdown-93d17b9cc4a3f53dc2059e44a691a28797422d21.tar.gz |
Support custom CSS class on TOC element
Closes #1224
Diffstat (limited to 'tests/test_syntax/extensions/test_toc.py')
-rw-r--r-- | tests/test_syntax/extensions/test_toc.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test_syntax/extensions/test_toc.py b/tests/test_syntax/extensions/test_toc.py index 6871340..d879f6e 100644 --- a/tests/test_syntax/extensions/test_toc.py +++ b/tests/test_syntax/extensions/test_toc.py @@ -569,3 +569,46 @@ class TestTOC(TestCase): '<p>[TOC]<br />\ntext</p>', extensions=[TocExtension(), Nl2BrExtension()] ) + + def testTOCWithCustomClass(self): + + self.assertMarkdownRenders( + self.dedent( + ''' + [TOC] + # Header + ''' + ), + self.dedent( + ''' + <div class="custom"> + <ul> + <li><a href="#header">Header</a></li> + </ul> + </div> + <h1 id="header">Header</h1> + ''' + ), + extensions=[TocExtension(toc_class="custom")] + ) + + def testTOCWithCustomClasses(self): + self.assertMarkdownRenders( + self.dedent( + ''' + [TOC] + # Header + ''' + ), + self.dedent( + ''' + <div class="custom1 custom2"> + <ul> + <li><a href="#header">Header</a></li> + </ul> + </div> + <h1 id="header">Header</h1> + ''' + ), + extensions=[TocExtension(toc_class="custom1 custom2")] + ) |