Public Access
feat(pwa): make the app installable
Manifest, gamepad icon (also the new favicon, instead of the Vite logo), iOS meta tags and the tab title ToBePlayed. No service worker, so a deploy never meets an old cached bundle. The title bar color follows light and dark mode. The README also lists adding a game by name.
This commit is contained in:
1 parent
444b03acee
commit
f8e6c2c970
12 files changed
+117
-3
No files matched your search
@@ -0,0 +1,35 @@
|
||||
// @vitest-environment jsdom
|
||||
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
|
||||
import {act, cleanup, render} from '@testing-library/react';
|
||||
import {PreferencesProvider, usePreferences} from './PreferencesContext.jsx';
|
||||
|
||||
vi.mock('react-i18next', () => import('../test/i18n-mock.js'));
|
||||
|
||||
let preferences;
|
||||
function Spy() {
|
||||
preferences = usePreferences();
|
||||
return null;
|
||||
}
|
||||
|
||||
const themeColor = () => document.querySelector('meta[name="theme-color"]').content;
|
||||
|
||||
beforeEach(() => {
|
||||
document.head.innerHTML = '<meta name="theme-color" content="#09090b">';
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
describe('PreferencesProvider theme color', () => {
|
||||
it('gives the installed app a light title bar in light mode and a dark one again in dark mode', () => {
|
||||
localStorage.setItem('tbp_dark_mode', 'false');
|
||||
render(<PreferencesProvider><Spy/></PreferencesProvider>);
|
||||
|
||||
expect(themeColor()).toBe('#fafafa');
|
||||
|
||||
act(() => preferences.setDarkMode(true));
|
||||
expect(themeColor()).toBe('#09090b');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user