From bed92e414531faae1d4604666c087b0fc6ce62e4 Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Mon, 4 Mar 2024 10:54:33 +0000 Subject: [PATCH] Use breadcrumbs for wagtail.locales views --- wagtail/locales/tests.py | 21 ++++++++++++++++++--- wagtail/locales/views.py | 1 - 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/wagtail/locales/tests.py b/wagtail/locales/tests.py index cdba0cfde997..ccf11bec1369 100644 --- a/wagtail/locales/tests.py +++ b/wagtail/locales/tests.py @@ -20,7 +20,10 @@ def test_simple(self): response = self.get() self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, "wagtailadmin/generic/index.html") - self.assertBreadcrumbsNotRendered(response.content) + self.assertBreadcrumbsItemsRendered( + [{"url": "", "label": "Locales"}], + response.content, + ) class TestLocaleCreateView(AdminTemplateTestUtils, WagtailTestUtils, TestCase): @@ -43,7 +46,13 @@ def test_simple(self): response = self.get() self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, "wagtaillocales/create.html") - self.assertBreadcrumbsNotRendered(response.content) + self.assertBreadcrumbsItemsRendered( + [ + {"label": "Locales", "url": "/admin/locales/"}, + {"label": "New: Locale", "url": ""}, + ], + response.content, + ) self.assertEqual( response.context["form"].fields["language_code"].choices, [("fr", "French")] @@ -116,7 +125,13 @@ def test_simple(self): response = self.get() self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, "wagtaillocales/edit.html") - self.assertBreadcrumbsNotRendered(response.content) + self.assertBreadcrumbsItemsRendered( + [ + {"url": "/admin/locales/", "label": "Locales"}, + {"url": "", "label": str(self.english)}, + ], + response.content, + ) self.assertEqual( response.context["form"].fields["language_code"].choices, diff --git a/wagtail/locales/views.py b/wagtail/locales/views.py index 43ec51cb75eb..9d6e4559314b 100644 --- a/wagtail/locales/views.py +++ b/wagtail/locales/views.py @@ -98,7 +98,6 @@ class LocaleViewSet(ModelViewSet): model = Locale permission_policy = locale_permission_policy add_to_reference_index = False - _show_breadcrumbs = False index_view_class = IndexView add_view_class = CreateView