35 lines
2.0 KiB
TypeScript
35 lines
2.0 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
const styles = readFileSync(new URL('../../src/styles/layout.css', import.meta.url), 'utf8');
|
|
const app = readFileSync(new URL('../../src/app/App.tsx', import.meta.url), 'utf8');
|
|
|
|
describe('Work header layout', () => {
|
|
it('haelt Werkzeug- und Ansichtsaktionen vollstaendig sichtbar', () => {
|
|
expect(styles).toMatch(/\.reader-toolbar\s*\{[^}]*overflow-x:\s*auto;[^}]*overflow-y:\s*hidden;/s);
|
|
expect(styles).toMatch(/\.workspace-btn\s*\{[^}]*flex:\s*0 0 auto;[^}]*min-width:\s*112px;[^}]*white-space:\s*nowrap;/s);
|
|
expect(styles).toMatch(/\.view-tabs\s*\{[^}]*flex:\s*0 0 auto;[^}]*overflow:\s*visible;/s);
|
|
expect(styles).toMatch(/\.tab-btn\s*\{[^}]*flex:\s*0 0 auto;[^}]*white-space:\s*nowrap;/s);
|
|
expect(styles).toMatch(/\.header-export-row\s*\{[^}]*flex:\s*0 0 auto;[^}]*overflow:\s*visible;/s);
|
|
expect(styles).toMatch(/\.work-timeslot-select\s*\{[^}]*flex:\s*0 0 180px;[^}]*width:\s*180px;/s);
|
|
});
|
|
|
|
it('laesst die toolabhaengige Filterableitung unveraendert', () => {
|
|
expect(app).toContain('<div className="workbar"><SearchFilterBar/></div>');
|
|
expect(app).toContain('<button className={`btn workspace-btn');
|
|
expect(app).toContain("['records', 'Reports']");
|
|
expect(app).toContain("['raw', 'Raw Data']");
|
|
expect(app).toContain('<SheetAndSearchControls/>');
|
|
expect(app).toContain('<WorkTimeslotControl/>');
|
|
});
|
|
|
|
it('oeffnet Work aus der Navigation mit Standardfilter und erhaelt explizite Drilldowns', () => {
|
|
expect(app).toMatch(/const openWork = useCallback\(\(\) => \{\s*setView\('records'\);\s*setActiveArea\('work'\);/s);
|
|
expect(app).toContain('onClick={() => navigateArea(area)}');
|
|
expect(app).toContain("if (area === 'work') openWorkDefault(); else setActiveArea(area);");
|
|
expect(app).toContain('if (!hasIncomingFilter) app.resetFilters();');
|
|
expect(app).toContain('<DashboardPanel onOpenWork={openWork}/>');
|
|
expect(app).toContain('onOpenFinding={openWork}');
|
|
});
|
|
});
|