guest role; guide section ticking
This commit is contained in:
@@ -559,3 +559,20 @@ def test_renaming_a_guide_does_not_move_its_url(client, db, author):
|
||||
assert fixed.status_code == 200
|
||||
assert fixed.get_json()['data']['slug'] == slug, 'the URL must not move'
|
||||
assert fixed.get_json()['data']['title'] == 'Replacing a marker controller'
|
||||
|
||||
def test_a_section_counts_as_something_to_tick():
|
||||
"""A reader crosses off a step or a heading to keep their place, so those
|
||||
count towards progress too. A guide converted from an article often has
|
||||
fifty headings and no steps at all, and "0 steps to tick" on a card that is
|
||||
entirely tickable reads as a broken feature."""
|
||||
from plugins.guides.services.blocks import checklistitemcount
|
||||
blocks = [
|
||||
_block('b1', 'heading', text='Before you start'),
|
||||
_block('b2', 'paragraph', text='Not tickable.'),
|
||||
_block('b3', 'step', title='Do the thing'),
|
||||
_block('b4', 'checklist', items=[{'id': 'i1', 'text': 'One'},
|
||||
{'id': 'i2', 'text': 'Two'}]),
|
||||
_block('b5', 'code', text='echo hi'),
|
||||
]
|
||||
# heading + step + two checklist items
|
||||
assert checklistitemcount(blocks) == 4
|
||||
|
||||
Reference in New Issue
Block a user