feat: 侧边栏默认亮色主题,暗黑主题下跟随切换
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user