1
0

feat: 侧边栏默认亮色主题,暗黑主题下跟随切换

This commit is contained in:
2026-04-17 00:30:26 +08:00
parent ddd284c1ca
commit 49818ed4d8
5 changed files with 72 additions and 16 deletions

View File

@@ -72,4 +72,36 @@ describe('AppLayout', () => {
const header = container.querySelector('.ant-layout-header') as HTMLElement;
expect(header.style.background).toBe('#141414');
});
it('uses light menu theme in default mode', async () => {
const { useTheme } = await import('@/contexts/ThemeContext');
vi.mocked(useTheme).mockReturnValue({
effectiveThemeId: 'default',
themeId: 'default',
followSystem: false,
systemIsDark: false,
setThemeId: vi.fn(),
setFollowSystem: vi.fn(),
});
const { container } = renderWithRouter(<AppLayout />);
expect(container.querySelector('.ant-menu-light')).toBeInTheDocument();
expect(container.querySelector('.ant-menu-dark')).not.toBeInTheDocument();
});
it('uses dark menu theme in dark mode', async () => {
const { useTheme } = await import('@/contexts/ThemeContext');
vi.mocked(useTheme).mockReturnValue({
effectiveThemeId: 'dark',
themeId: 'dark',
followSystem: false,
systemIsDark: false,
setThemeId: vi.fn(),
setFollowSystem: vi.fn(),
});
const { container } = renderWithRouter(<AppLayout />);
expect(container.querySelector('.ant-menu-dark')).toBeInTheDocument();
expect(container.querySelector('.ant-menu-light')).not.toBeInTheDocument();
});
});