open-design/apps/web/tests/styles/default-background.test.ts
Marc Chan 619087a6b4
refactor(web): split global CSS by ownership (#2609)
* refactor(web): split global CSS by ownership

* test(web): expand CSS imports in style checks

* fix(web): keep privacy consent banner above modals
2026-05-25 05:48:28 +00:00

27 lines
914 B
TypeScript

import { describe, expect, it } from 'vitest';
import { readExpandedIndexCss } from '../helpers/read-expanded-css';
const indexCss = readExpandedIndexCss();
function cssBlock(selector: string): string {
const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const match = new RegExp(`${escaped}\\s*\\{([^}]*)\\}`).exec(indexCss);
if (!match) throw new Error(`Missing CSS block for ${selector}`);
return match[1] ?? '';
}
describe('default app background colors', () => {
it('uses the release light background color by default', () => {
const root = cssBlock(':root');
expect(root).toContain('--bg: #faf9f7;');
expect(root).toContain('--bg-app: #faf9f7;');
});
it('keeps the dark theme background unchanged', () => {
const dark = cssBlock('[data-theme="dark"]');
expect(dark).toContain('--bg: #1a1917;');
expect(dark).toContain('--bg-app: #1a1917;');
});
});