返回 ViMax
theme.test.ts
根目录 / web / src / theme.test.ts
1 import {describe, expect, it} from 'vitest';
2 import {resolveTheme} from './theme';
3
4 describe('theme selection', () => {
5 it('uses an explicit saved theme', () => {
6 expect(resolveTheme('dark', false)).toBe('dark');
7 expect(resolveTheme('light', true)).toBe('light');
8 });
9
10 it('falls back to the system preference', () => {
11 expect(resolveTheme(null, true)).toBe('dark');
12 expect(resolveTheme(undefined, false)).toBe('light');
13 });
14 });
15
15 lines TYPESCRIPT