mock-mediaTheme.ts 407 B

12345678910111213
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { EnumAppearanceTheme } from '#shared/graphql/types.ts'
  3. export const addEventListener = vi.fn()
  4. export const mockMediaTheme = (theme: EnumAppearanceTheme) => {
  5. window.matchMedia = (rule) =>
  6. ({
  7. matches: rule === '(prefers-color-scheme: dark)' && theme === 'dark',
  8. addEventListener,
  9. }) as any
  10. }