b868e8012d
One web part replaces the separate stroy-bot-* web parts. The section and its parameters live in the page query string (?page=objects&projectId=5), so links can be copied, opened in a new tab and the browser Back button works. - shared config: site/Dataverse/API addresses, list and table names - HTTP layer behind IHttpClient so repositories can be unit-tested - ui-kit AppLayout + Sidebar, placeholder for sections not ported yet - migration checklist with every feature of the old web parts - design tokens mirrored from ui-kit instead of 8 copies Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { buildSidebarItems, navPageFor } from './navigation';
|
|
|
|
describe('buildSidebarItems', () => {
|
|
it('без проекта в меню только главная', () => {
|
|
expect(buildSidebarItems(undefined).map((item) => item.id)).toEqual(['hub']);
|
|
});
|
|
|
|
it('с проектом — все разделы', () => {
|
|
expect(buildSidebarItems('5').map((item) => item.id)).toEqual([
|
|
'hub',
|
|
'objects',
|
|
'reports',
|
|
'report',
|
|
'import',
|
|
'resources',
|
|
'binder'
|
|
]);
|
|
});
|
|
|
|
it('недоступные разделы скрываются, главная остаётся всегда', () => {
|
|
const onlyReports = (page: string): boolean => page === 'reports';
|
|
expect(buildSidebarItems('5', onlyReports).map((item) => item.id)).toEqual(['hub', 'reports']);
|
|
});
|
|
});
|
|
|
|
describe('navPageFor', () => {
|
|
it('работы подсвечивают пункт «Объекты»', () => {
|
|
expect(navPageFor('works')).toEqual('objects');
|
|
});
|
|
|
|
it('остальные разделы подсвечивают сами себя', () => {
|
|
expect(navPageFor('reports')).toEqual('reports');
|
|
});
|
|
});
|