1
This commit is contained in:
@@ -4,15 +4,17 @@ import { act, render, screen } from '@testing-library/react';
|
||||
import { createElement } from 'react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { RouteImageReadyGate } from './RouteImageReadyGate';
|
||||
import {
|
||||
collectRouteImageUrls,
|
||||
extractCssImageUrls,
|
||||
normalizePreloadImageUrl,
|
||||
} from './routeImageReadyGateUtils';
|
||||
import { RouteImageReadyGate } from './RouteImageReadyGate';
|
||||
import { RouteLoadingScreen } from './RouteLoadingScreen';
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
window.localStorage.clear();
|
||||
});
|
||||
|
||||
describe('RouteImageReadyGate image url helpers', () => {
|
||||
@@ -84,4 +86,27 @@ describe('RouteImageReadyGate image url helpers', () => {
|
||||
expect(visibilityGate?.getAttribute('aria-hidden')).toBe('false');
|
||||
expect(visibilityGate?.style.visibility).toBe('visible');
|
||||
});
|
||||
|
||||
it('uses the saved platform theme tokens for the route loading screen', () => {
|
||||
window.localStorage.setItem(
|
||||
'tavernrealms.settings.v1',
|
||||
JSON.stringify({
|
||||
version: 1,
|
||||
musicVolume: 0.42,
|
||||
platformTheme: 'dark',
|
||||
}),
|
||||
);
|
||||
|
||||
const { container } = render(
|
||||
createElement(RouteLoadingScreen, {
|
||||
eyebrow: '正在载入游戏',
|
||||
text: '正在载入冒险...',
|
||||
}),
|
||||
);
|
||||
const shell = container.firstElementChild;
|
||||
|
||||
expect(shell?.classList.contains('platform-theme')).toBe(true);
|
||||
expect(shell?.classList.contains('platform-theme--dark')).toBe(true);
|
||||
expect(shell?.className).toContain('bg-[image:var(--platform-body-fill)]');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user