krona-staff/tests/unit/portal-ui.test.ts
2026-09-26 12:58:51 +07:00

28 lines
1.5 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { portalCssEnhanced, portalHtml, portalJsEnhanced, portalManifest } from '../../src/portal-ui.js';
describe('Krona Staff workspace shell', () => {
it('exposes the five approved top-level sections with deep routes', () => {
expect(portalHtml).toContain('data-route="/staff/dashboard">Дашборд');
expect(portalHtml).toContain('data-route="/staff/employees">Сотрудники');
expect(portalHtml).toContain('data-route="/staff/finance">Финансы');
expect(portalHtml).toContain('data-route="/staff/schedules">Графики');
expect(portalHtml).toContain('data-route="/staff/payroll">Зарплата');
expect(portalHtml).not.toContain('<aside class="sidebar"');
});
it('uses the Krona Library semantic theme vocabulary', () => {
expect(portalCssEnhanced).toContain('--omni-bg-workspace');
expect(portalCssEnhanced).toContain('[data-omni-theme="noble-green"]');
expect(portalCssEnhanced).toContain('[data-omni-theme="parchment-light"]');
expect(portalCssEnhanced).toContain('[data-omni-theme="graphite-forest-dark"]');
expect(portalCssEnhanced).toContain('var(--omni-primary)');
});
it('keeps navigation addressable and starts the PWA on the dashboard', () => {
expect(portalJsEnhanced).toContain("'/staff/employees':'employees-view'");
expect(portalJsEnhanced).toContain("window.addEventListener('popstate'");
expect(JSON.parse(portalManifest)).toMatchObject({ start_url: '/staff/dashboard', scope: '/staff' });
});
});