Improve collection management UX
This commit is contained in:
+26
-2
@@ -72,6 +72,13 @@ class DueDateCommandTests(TestCase):
|
||||
self.assertNotIn('/morgen', item.content)
|
||||
self.assertIsNotNone(item.due_at)
|
||||
|
||||
def test_due_commands_inside_code_are_ignored(self):
|
||||
raw = '/todo Example\n```\n/morgen\n/datum 20.10.26\n```'
|
||||
cleaned, due_at, found = parse_due_command(raw)
|
||||
self.assertFalse(found)
|
||||
self.assertIsNone(due_at)
|
||||
self.assertEqual(cleaned, raw)
|
||||
|
||||
def test_type_and_date_commands_are_available_in_menu(self):
|
||||
response = self.client.get(reverse('index'))
|
||||
self.assertContains(response, "{token:'/note'")
|
||||
@@ -89,6 +96,13 @@ class SlashMenuContextTests(TestCase):
|
||||
self.assertEqual(later_kind, Item.Kind.NOTE)
|
||||
self.assertEqual(later_content, 'Text /todo later')
|
||||
|
||||
def test_visibility_commands_inside_code_are_ignored(self):
|
||||
kind, visibility, content, _ = parse_quick_content('/note Example ` /public `\n```\n/private\n```')
|
||||
self.assertEqual(kind, Item.Kind.NOTE)
|
||||
self.assertEqual(visibility, Item.Visibility.PRIVATE)
|
||||
self.assertIn('/public', content)
|
||||
self.assertIn('/private', content)
|
||||
|
||||
|
||||
class MarkdownHeadingTests(TestCase):
|
||||
def test_tag_at_line_start_is_not_a_heading(self):
|
||||
@@ -341,8 +355,7 @@ class CollectionTests(TestCase):
|
||||
self.assertContains(response, 'hx-boost="true"')
|
||||
self.assertContains(response, 'hx-swap="outerHTML show:none"')
|
||||
self.assertContains(response, f'{reverse("item_editor", args=[note.id])}?next={manage_url}')
|
||||
self.assertContains(response, '>Section</')
|
||||
self.assertNotContains(response, '>## Section</')
|
||||
self.assertContains(response, 'href="#section-1">Section')
|
||||
|
||||
def test_collection_manage_preserves_search_when_adding_note(self):
|
||||
collection = Collection.objects.create(owner=self.user, title='Reading view')
|
||||
@@ -353,6 +366,17 @@ class CollectionTests(TestCase):
|
||||
|
||||
self.assertRedirects(response, f'{manage_url}?q=Findable')
|
||||
|
||||
def test_collection_manage_marks_already_added_notes(self):
|
||||
collection = Collection.objects.create(owner=self.user, title='Reading view')
|
||||
note = Item.objects.create(owner=self.user, kind=Item.Kind.NOTE, content='Findable note')
|
||||
CollectionSection.objects.create(collection=collection, item=note, position=0)
|
||||
|
||||
response = self.client.get(f'{reverse("collection_manage", args=[collection.id])}?q=Findable')
|
||||
|
||||
self.assertContains(response, 'Bereits in dieser Sammlung')
|
||||
self.assertContains(response, '1× verwendet')
|
||||
self.assertContains(response, 'disabled')
|
||||
|
||||
def test_collection_can_include_collection(self):
|
||||
parent = Collection.objects.create(owner=self.user, title='Parent')
|
||||
child = Collection.objects.create(owner=self.user, title='Child')
|
||||
|
||||
Reference in New Issue
Block a user