Show a message when the calendar has no events (#35)
Unit Tests / test (push) Successful in 5s

## Summary
Closes #34.
- Upcoming and Past calendar tabs show a short message when that list is empty, so a calendar with no events is no longer a blank content area.
- Empty copy stays hidden on a tab that has events.

## Test plan
- [ ] Open `/calendar` with no `CalendarEvent` rows and confirm Upcoming says “There are no upcoming events to display.”
- [ ] Switch to Past and confirm it says “There are no past events to display.”
- [ ] Add an upcoming event and confirm the Upcoming message is gone while Past still shows its empty message if there are no past events.
- [ ] `uv run python manage.py test schasite.tests.PublicPageTests.test_calendar_shows_empty_state_when_no_events schasite.tests.CalendarEventTests.test_calendar_page_splits_past_and_future`

Reviewed-on: #35
This commit was merged in pull request #35.
This commit is contained in:
westfarn committed 2026-10-10 04:14:37 -07:00
1 parent 783712972b
commit 753dd495b4
2 files changed
+21 -2

No files matched your search

+9
View File
@@ -66,6 +66,13 @@ class PublicPageTests(TestCase):
response = self.client.get(reverse("calendar2"))
self.assertEqual(response.status_code, 200)
def test_calendar_shows_empty_state_when_no_events(self):
response = self.client.get(reverse("calendar2"))
self.assertEqual(response.status_code, 200)
self.assertContains(response, "There are no upcoming events to display.")
self.assertContains(response, "There are no past events to display.")
def test_newsletters_renders(self):
response = self.client.get(reverse("newsletters2"))
self.assertEqual(response.status_code, 200)
@@ -414,6 +421,8 @@ class CalendarEventTests(TestCase):
self.assertNotIn("Ongoing Event", past_html)
self.assertIn("Archived Picnic", past_html)
self.assertNotIn("Archived Picnic", upcoming_html)
self.assertNotIn("There are no upcoming events to display.", upcoming_html)
self.assertNotIn("There are no past events to display.", past_html)
@override_settings(