From cc2da50569d666066f6a5c36a520190f0c8deacd Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Sat, 7 Feb 2026 17:34:59 -0500 Subject: [PATCH] Add tests for AJAX comment submission and capability-driven presentation. 17 new tests: template validation for noscript/js-only pattern, functional tests for AJAX replies (JSON 201, rendered HTML, parent_id, author name, database persistence, graceful fallback to redirect), and anonymous AJAX reply tests. --- remarkbox/tests/test_templates.py | 49 +++++ remarkbox/tests/test_views.py | 329 ++++++++++++++++++++++++++++++ 2 files changed, 378 insertions(+) diff --git a/remarkbox/tests/test_templates.py b/remarkbox/tests/test_templates.py index 93cfc08..85e655e 100644 --- a/remarkbox/tests/test_templates.py +++ b/remarkbox/tests/test_templates.py @@ -87,5 +87,54 @@ class TestTemplateValidation(unittest.TestCase): self.fail(f"show-node.j2 has syntax error at line {e.lineno}: {e.message}") +class TestCapabilityDrivenPresentation(unittest.TestCase): + """Test capability-driven presentation patterns (js-only / noscript).""" + + @classmethod + def setUpClass(cls): + tests_dir = Path(__file__).parent + cls.templates_dir = tests_dir.parent / "templates" + cls.static_dir = tests_dir.parent / "static" + + def test_base_template_has_noscript_js_only_pattern(self): + """Verify base.j2 contains the noscript/js-only hide pattern.""" + base_content = (self.templates_dir / "base.j2").read_text() + self.assertIn("