"""Test cases for Tabbed."""
from .. import util
from pymdownx.slugs import slugify
class TestLegacyTab(util.MdCase):
"""Test legacy tab cases."""
extension = ['pymdownx.tabbed', 'pymdownx.superfences', 'markdown.extensions.def_list', 'pymdownx.details']
extension_configs = {}
def test_with_preceding_text(self):
"""Test content directly before tabs."""
expected = r'''
foo
foo
''' # noqa: E501
self.check_markdown(
r'''
foo
**foo**
=== "Tab"
''',
expected,
True
)
def test_tabbed(self):
"""Test tabbed."""
self.check_markdown(
r'''
=== "Tab"
Some *content*
And more `content`.
=== "Another Tab"
Some more content.
```
code
```
''',
r'''
Some content
And more content.
Some more content.
code
''', # noqa: E501
True
)
def test_tabbed_markdown_title(self):
"""Test tabbed."""
self.check_markdown(
R'''
=== "**Tab**"
Some *content*
And more `content`.
=== "_Another Tab_"
Some more content.
```
code
```
''',
r'''
Some content
And more content.
Some more content.
code
''', # noqa: E501
True
)
def test_nested_tabbed(self):
"""Test nested tabbed."""
self.check_markdown(
r'''
=== "Tab"
Some *content*
=== "Tab A"
- item 1
- item 2
=== "Tab B"
- item A
- item B
=== "Another Tab"
Some more content.
''',
r'''
Some content
item 1
item 2
item A
item B
Some more content.
''', # noqa: E501
True
)
def test_tabbed_split(self):
"""Force a split of tab sets."""
self.check_markdown(
r'''
=== "Tab"
Some *content*
And more `content`.
===! "Another Tab"
Some more content.
```
code
```
''',
r'''
Some content
And more content.
Some more content.
code
''', # noqa: E501
True
)
def test_tabbed_break(self):
"""Test that tabs are properly terminated on blocks that are not under the tab."""
self.check_markdown(
r'''
=== "Tab"
Some *content*
And more `content`.
Content
''',
r'''
''', # noqa: E501
True
)
def test_with_big_lists(self):
"""Test details with a longer list."""
self.check_markdown(
'''
- List
=== "Tab"
- Paragraph
Paragraph
- Paragraph
paragraph
''',
'''
List
Paragraph
Paragraph
Paragraph
paragraph
''', # noqa: E501
True
)
def test_with_complex_lists(self):
"""Test details in a complex list scenario."""
self.check_markdown(
'''
- List
=== "Tab"
- Paragraph
=== "Tab"
1. Paragraph
Paragraph
''',
'''
List
Paragraph
Paragraph
Paragraph
''', # noqa: E501
True
)
def test_definition_list(self):
"""Test with definition list."""
self.check_markdown(
'''
- List
=== "Tab"
Term
: Definition
More text
: Another
definition
Even more text
''',
'''