1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Refs #34041 -- Added navigation landmark to breadcrumbs in admin.

Thanks Thibaud Colas for pair programming.
This commit is contained in:
Florian Perucki
2022-09-24 17:47:41 +02:00
committed by Mariusz Felisiak
parent fe6f4bef03
commit 872b61193b
5 changed files with 39 additions and 7 deletions

View File

@@ -0,0 +1,25 @@
from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from django.urls import reverse
@override_settings(ROOT_URLCONF="admin_views.urls")
class AdminBreadcrumbsTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.superuser = User.objects.create_superuser(
username="super",
password="secret",
email="super@example.com",
)
def setUp(self):
self.client.force_login(self.superuser)
def test_breadcrumbs_absent(self):
response = self.client.get(reverse("admin:index"))
self.assertNotContains(response, '<nav aria-label="Breadcrumbs">')
def test_breadcrumbs_present(self):
response = self.client.get(reverse("admin:auth_user_add"))
self.assertContains(response, '<nav aria-label="Breadcrumbs">')