Skip to content

Test: cover prefers-color-scheme fallback in ThemeContext#11

Open
LucyJillMurray wants to merge 1 commit into
Joun-Mikhail:mainfrom
LucyJillMurray:feat/respect-os-theme-preference
Open

Test: cover prefers-color-scheme fallback in ThemeContext#11
LucyJillMurray wants to merge 1 commit into
Joun-Mikhail:mainfrom
LucyJillMurray:feat/respect-os-theme-preference

Conversation

@LucyJillMurray

Copy link
Copy Markdown

Title: Test OS theme preference fallback in ThemeContext

Description:

Summary

This PR implements tests for the OS theme preference fallback behavior in the ThemeContext provider. When there's no stored user preference, the provider should fall back to the OS color scheme preference (via window.matchMedia).

Closes #6

Changes

  • Create ThemeContext.test.tsx with test cases:
    • Should fall back to dark mode when OS prefers dark and no stored preference
    • Should fall back to light mode when OS prefers light and no stored preference
    • Should prioritize stored user preference over OS preference
    • Should update stored preference on explicit user toggle

Checklist

  • Tests added or updated
  • ruff, mypy, and pytest pass for the backend
  • npm run lint, npm run typecheck, npm test, and npm run build pass for the frontend
  • Documentation updated where relevant
  • No secrets, debug output, or commented-out code left behind

Implement tests for the OS theme preference fallback in ThemeContext.

The ThemeContext provider falls back to the OS color scheme preference
(via `window.matchMedia`) when there's no stored user preference.
This commit adds test coverage for that behavior.

Key changes:

- Create `ThemeContext.test.tsx` with test cases:
  - Should fall back to dark mode when OS prefers dark and no stored preference
  - Should fall back to light mode when OS prefers light and no stored preference
  - Should prioritize stored user preference over OS preference
  - Should update stored preference on explicit user toggle

Closes Joun-Mikhail#6
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

@LucyJillMurray is attempting to deploy a commit to the joun-mikhail's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect prefers-color-scheme on first visit

1 participant