Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@
STATIC_URL = "/static/"
SITE_ID = 1
WAGTAIL_SITE_NAME = "My Example Site"
WAGTAILMARKDOWN_EXTENSIONS = ["toc"]
16 changes: 16 additions & 0 deletions tests/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,19 @@ def test_canonical_url(client):
soup = BeautifulSoup(res.content, "html.parser")
el = soup.find("link", attrs={"rel": "canonical"})
assert el["href"] == "https://foo.com"


def test_renders_toc(client):
post = BlogPage(
title="My post",
body="""
[TOC]
# first paragraph""",
date=timezone.now(),
)
pages = [(BlogIndexPage(title="index"), [post])]
with page_tree(pages):
[(_, [post])] = pages
res = client.get(post.get_url())
assert res.status_code == 200
assert BeautifulSoup(res.content, "html.parser").select(".toc")
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ passenv =
addopts = --ds=tests.settings.test --reuse-db -ra
testpaths = tests
norecursedirs = .git */migrations/* .venv
filterwarnings =
ignore::django.utils.deprecation.RemovedInDjango40Warning

[isort]
recursive = True
Expand Down