Repository: wagtail/wagtail
File: wagtail/admin/tests/test_templatetags.py (Python)

Code before:
        self.assertIn("my-class", div["class"])

    def test_icon_name(self):
        template = """
            {% load wagtailadmin_tags %}
            {% page_breadcrumbs page 'wagtailadmin_explore' icon_name='site' %}
        """
        page = Page.objects.get(id=3)
        items = [
            {"label": "Root", "url": "/admin/pages/1/"},
            {"label": "Welcome to the Wagtail test site!", "url": "/admin/pages/2/"},
            {"label": "Events", "url": "/admin/pages/3/"},
        ]
        rendered = Template(template).render(
            Context({"page": page, "request": self.request})
        )
        self.assertBreadcrumbsItemsRendered(items, rendered)

        soup = self.get_soup(rendered)
        invalid_icons = soup.select("ol li:not(:last-child) svg use[href='#icon-site']")
        self.assertEqual(len(invalid_icons), 0)
        icon = soup.select_one("ol li:last-child svg use[href='#icon-site']")
        self.assertIsNotNone(icon)


class DarkLightModeTest(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
    fixtures = ["test.json"]

    def setUp(self):
        self.request = get_dummy_request()
        self.user = self.login()
        self.request.user = self.user

        self.profile, created = UserProfile.objects.get_or_create(user=self.user)

    def test_default_mode(self):
        template = """
            {% load wagtailadmin_tags %}
            <meta name="color-scheme" content="{% admin_theme_color_scheme %}">
        """
        page = Page.objects.get(id=1)
        rendered = Template(template).render(
            Context({"page": page, "request": self.request})
        )

        soup = self.get_soup(rendered)
        meta_tag = soup.find("meta", {"name": "color-scheme"})
        self.assertIsNotNone(meta_tag)
        self.assertIn("dark", meta_tag["content"])
        self.assertIn("light", meta_tag["content"])


Review comment (suggestion):
```suggestion
class ThemeColorSchemeTest(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
```

Code after:
        self.assertIn("my-class", div["class"])

    def test_icon_name(self):
        template = """
            {% load wagtailadmin_tags %}
            {% page_breadcrumbs page 'wagtailadmin_explore' icon_name='site' %}
        """
        page = Page.objects.get(id=3)
        items = [
            {"label": "Root", "url": "/admin/pages/1/"},
            {"label": "Welcome to the Wagtail test site!", "url": "/admin/pages/2/"},
            {"label": "Events", "url": "/admin/pages/3/"},
        ]
        rendered = Template(template).render(
            Context({"page": page, "request": self.request})
        )
        self.assertBreadcrumbsItemsRendered(items, rendered)

        soup = self.get_soup(rendered)
        invalid_icons = soup.select("ol li:not(:last-child) svg use[href='#icon-site']")
        self.assertEqual(len(invalid_icons), 0)
        icon = soup.select_one("ol li:last-child svg use[href='#icon-site']")
        self.assertIsNotNone(icon)


class ThemeColorSchemeTest(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
    def setUp(self):
        self.request = get_dummy_request()
        self.user = self.login()
        self.request.user = self.user
        self.profile = UserProfile.get_for_user(self.user)

    def test_default_mode(self):
        template = """
            {% load wagtailadmin_tags %}
            <meta name="color-scheme" content="{% admin_theme_color_scheme %}">
        """
        rendered = Template(template).render(Context({"request": self.request}))

        soup = self.get_soup(rendered)
        meta_tag = soup.find("meta", {"name": "color-scheme"})
        self.assertIsNotNone(meta_tag)
        self.assertEqual(meta_tag["content"], "dark light")

    def test_dark_mode(self):
        self.profile.theme = "dark"
        self.profile.save()

        template = """
            {% load wagtailadmin_tags %}
            <meta name="color-scheme" content="{% admin_theme_color_scheme %}">