From bbb6fc242a4eb10551a8549c400f3db88658fce1 Mon Sep 17 00:00:00 2001 From: kosayoda Date: Thu, 1 Apr 2021 19:11:28 +0800 Subject: Add a dropdown menu listing direct children. This only shows when the page is also a category, since regular pages have no children and regular categories already list their children. --- pydis_site/apps/content/tests/test_templatetags.py | 12 ++++++++++++ pydis_site/apps/content/tests/test_views.py | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 pydis_site/apps/content/tests/test_templatetags.py (limited to 'pydis_site/apps/content/tests') diff --git a/pydis_site/apps/content/tests/test_templatetags.py b/pydis_site/apps/content/tests/test_templatetags.py new file mode 100644 index 00000000..1147bd88 --- /dev/null +++ b/pydis_site/apps/content/tests/test_templatetags.py @@ -0,0 +1,12 @@ +from django.test import TestCase + +from pydis_site.apps.content.templatetags.str_methods import replace_hyphens + + +class TestTemplateTags(TestCase): + """Tests for the custom template tags in the content app.""" + + def test_replace_hyphens(self): + self.assertEquals(replace_hyphens("word-with-hyphens", " "), "word with hyphens") + self.assertEquals(replace_hyphens("---", ""), "") + self.assertEquals(replace_hyphens("hi----", "A"), "hiAAAA") diff --git a/pydis_site/apps/content/tests/test_views.py b/pydis_site/apps/content/tests/test_views.py index ab266b29..cd0d0bf7 100644 --- a/pydis_site/apps/content/tests/test_views.py +++ b/pydis_site/apps/content/tests/test_views.py @@ -160,7 +160,8 @@ class PageOrCategoryViewTests(MockPagesTestCase, SimpleTestCase, TestCase): "page": PARSED_HTML, "page_title": PARSED_METADATA["title"], "page_description": PARSED_METADATA["description"], - "relevant_links": PARSED_METADATA["relevant_links"] + "relevant_links": PARSED_METADATA["relevant_links"], + "subarticles": ["category"] } for key, expected_value in expected_page_context.items(): with self.subTest(): -- cgit v1.2.3