Files
periscope/tests/test_periscope_frontend_theme_rewrite.py
michele c5cd98587f Rewrite class-based theme provider and toggle.
next-themes still defaults to dark with no system follow. Clerk theme wrapper stays inherited.
2026-09-20 20:11:20 +02:00

38 lines
1.3 KiB
Python

"""next-themes wrapper and toggle live under periscope/src."""
from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SRC = ROOT / "periscope" / "src" / "frontend" / "src"
def test_theme_modules_are_src():
for rel in (
"components/theme/theme-provider.tsx",
"components/theme/theme-toggle.tsx",
):
text = (SRC / rel).read_text(encoding="utf-8")
assert "Native Periscope overlay" not in text[:400]
def test_theme_provider_contract():
text = (SRC / "components/theme/theme-provider.tsx").read_text(encoding="utf-8")
assert "export function ThemeProvider" in text
assert 'attribute="class"' in text
assert 'defaultTheme="dark"' in text
assert "enableSystem={false}" in text
assert "disableTransitionOnChange" in text
clerk = SRC / "components/theme/clerk-theme-provider.tsx"
assert not clerk.exists()
def test_theme_toggle_contract():
text = (SRC / "components/theme/theme-toggle.tsx").read_text(encoding="utf-8")
assert "export function ThemeToggle" in text
assert 'aria-label="Toggle theme"' in text
assert "resolvedTheme" in text
assert 'className="hidden h-4 w-4 dark:block"' in text
assert 'className="h-4 w-4 dark:hidden"' in text