Refine slash menu and Markdown tags
This commit is contained in:
+28
-1
@@ -3,6 +3,7 @@ from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from .models import Item, Tag, UserPreference
|
||||
from .templatetags.markdown_extras import markdown
|
||||
from .views import parse_due_command, parse_quick_content
|
||||
|
||||
|
||||
@@ -75,7 +76,33 @@ class DueDateCommandTests(TestCase):
|
||||
response = self.client.get(reverse('index'))
|
||||
self.assertContains(response, "{token:'/note'")
|
||||
self.assertContains(response, "{token:'/datum'")
|
||||
self.assertContains(response, "let hasType=")
|
||||
self.assertContains(response, 'queryStart')
|
||||
self.assertContains(response, "group:'Typ'")
|
||||
|
||||
|
||||
class SlashMenuContextTests(TestCase):
|
||||
def test_type_command_only_counts_at_start(self):
|
||||
leading_kind, _, leading_content, _ = parse_quick_content('/todo Leading')
|
||||
later_kind, _, later_content, _ = parse_quick_content('Text /todo later')
|
||||
self.assertEqual(leading_kind, Item.Kind.TODO)
|
||||
self.assertEqual(leading_content, 'Leading')
|
||||
self.assertEqual(later_kind, Item.Kind.NOTE)
|
||||
self.assertEqual(later_content, 'Text /todo later')
|
||||
|
||||
|
||||
class MarkdownHeadingTests(TestCase):
|
||||
def test_tag_at_line_start_is_not_a_heading(self):
|
||||
rendered = str(markdown('#project starts here'))
|
||||
self.assertIn('<p>#project starts here</p>', rendered)
|
||||
self.assertNotIn('<h1>', rendered)
|
||||
|
||||
def test_heading_with_space_remains_a_heading(self):
|
||||
self.assertIn('<h1>Project</h1>', str(markdown('# Project')))
|
||||
|
||||
def test_hash_in_fenced_code_is_unchanged(self):
|
||||
rendered = str(markdown('```python\n# comment\n```'))
|
||||
self.assertIn('# comment', rendered)
|
||||
self.assertNotIn('\\# comment', rendered)
|
||||
|
||||
|
||||
class CopyButtonTests(TestCase):
|
||||
|
||||
Reference in New Issue
Block a user