mirror of
https://github.com/nexu-io/open-design.git
synced 2026-05-31 19:04:39 +07:00
* refactor(web): split global CSS by ownership * test(web): expand CSS imports in style checks * fix(web): keep privacy consent banner above modals
27 lines
914 B
TypeScript
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;');
|
|
});
|
|
});
|