Assessor_2.0/tests/features/panel-inset-standard.test.ts

34 lines
2.1 KiB
TypeScript

import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const tokens = readFileSync(new URL('../../src/styles/ui-tokens.css', import.meta.url), 'utf8');
const layout = readFileSync(new URL('../../src/styles/layout.css', import.meta.url), 'utf8');
const legacy = readFileSync(new URL('../../src/styles/legacy-views.css', import.meta.url), 'utf8');
const datahub = readFileSync(new URL('../../src/styles/datahub.css', import.meta.url), 'utf8');
const graph = readFileSync(new URL('../../src/styles/obsidian-graph.css', import.meta.url), 'utf8');
const guidance = readFileSync(new URL('../../AGENTS.md', import.meta.url), 'utf8');
describe('rounded panel content inset standard', () => {
it('defines the Work-derived 20px inset as the shared future-facing token', () => {
expect(tokens).toContain('--panel-content-inset: 20px;');
expect(tokens).toContain('--panel-inset: var(--panel-content-inset);');
expect(guidance).toContain('content inside every rounded main panel starts `20px` from each outer edge');
expect(guidance).toContain('Apply the inset exactly once');
});
it('uses the shared inset in every Work presentation including responsive tiles', () => {
expect(layout).toMatch(/\.tile-grid\s*\{[^}]*padding:\s*var\(--panel-inset\);/s);
expect(layout).toMatch(/\.raw-view\s*\{[^}]*padding:\s*var\(--panel-inset\);/s);
expect(legacy).toMatch(/\.records-layout\s*\{[^}]*padding:\s*var\(--panel-inset\);/s);
expect(legacy).toMatch(/\.table-scroll\s*\{[^}]*padding:\s*var\(--panel-inset\);/s);
expect(legacy).not.toMatch(/\.tile-grid\s*\{[^}]*padding:\s*var\(--legacy-space-2\);/s);
});
it('applies the same single outer inset to Datahub, Dashboard, client detail, and Pathfinder', () => {
expect(datahub).toMatch(/\.datahub-page\s*\{[^}]*padding:\s*var\(--panel-inset\);/s);
expect(datahub).toMatch(/\.dashboard-page\s*\{[^}]*padding:\s*var\(--panel-inset\);/s);
expect(datahub).toMatch(/\.datahub-page\.tenant-detail-page\s*\{[^}]*padding:\s*var\(--panel-inset\);/s);
expect(graph).toMatch(/\.obsidian-graph\s*\{[^}]*box-sizing:\s*border-box;[^}]*padding:\s*var\(--panel-inset\);/s);
});
});