section ticking covers the section
This commit is contained in:
@@ -212,3 +212,14 @@ def test_an_empty_document_produces_a_named_guide_and_no_blocks():
|
||||
parsed = parse('')
|
||||
assert parsed['title'] == 'Untitled'
|
||||
assert parsed['blocks'] == []
|
||||
|
||||
|
||||
def test_a_heading_carries_its_rank():
|
||||
"""Ticking a section off has to cross out what belongs to it, and nothing
|
||||
records that a sub-heading belongs to the heading above unless the level
|
||||
travels with them."""
|
||||
parsed = parse('<h1>T</h1><h2>Credentials</h2><p>Intro.</p>'
|
||||
'<h3>SFLD share</h3><p>Detail.</p><h2>Next</h2>')
|
||||
headings = [(b['text'], b.get('level'))
|
||||
for b in parsed['blocks'] if b['type'] == 'heading']
|
||||
assert headings == [('Credentials', 2), ('SFLD share', 3), ('Next', 2)]
|
||||
|
||||
Reference in New Issue
Block a user