feat: documentation and hookup in help menu

This commit is contained in:
2026-02-19 11:17:08 +01:00
parent 3d12cfbc89
commit d9690f70bd
11 changed files with 571 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
// @vitest-environment node
import { describe, expect, it } from 'vitest';
import { readFileSync } from 'node:fs';
import path from 'node:path';
describe('documentation structure and presentation', () => {
it('uses a main-chapter-only index and hierarchical headings', () => {
const docPath = path.resolve(process.cwd(), 'DOCUMENTATION.md');
const markdown = readFileSync(docPath, 'utf8');
expect(markdown).toContain('## Index');
expect(markdown).not.toMatch(/^\s{2,}-\s+\[/m);
expect(markdown).not.toMatch(/^##\s+\d+\)/m);
expect(markdown).toMatch(/^###\s+1\)/m);
});
it('scopes Pico conditional styling to the documentation view', () => {
const viewPath = path.resolve(
process.cwd(),
'src/renderer/components/DocumentationView/DocumentationView.tsx',
);
const source = readFileSync(viewPath, 'utf8');
expect(source).toContain('@picocss/pico/css/pico.conditional.slate.min.css');
expect(source).toContain('className="documentation-content markdown-body pico"');
expect(source).toContain('data-theme="auto"');
});
});

View File

@@ -0,0 +1,15 @@
import { describe, it, expect } from 'vitest';
import { APP_MENU_GROUPS, APP_MENU_ACTION_EVENT_MAP } from '../../src/main/shared/menuCommands';
describe('Help menu documentation entry', () => {
it('includes an Open Documentation action in Help menu', () => {
const helpGroup = APP_MENU_GROUPS.find((group) => group.label === 'Help');
expect(helpGroup).toBeDefined();
expect(helpGroup?.items.some((item) => item.action === 'openDocumentation')).toBe(true);
});
it('maps Open Documentation to a renderer menu event', () => {
expect(APP_MENU_ACTION_EVENT_MAP.openDocumentation).toBe('menu:openDocumentation');
});
});