* chore: updated todo with translation ideas * feat: first take at the implementation of translations * fix: small addition for the translation feature * feat: support language switching in the editor and preview * feat: better handling of long bodies by not running them through a json envelope * fix: unknown macros have better fallback * feat: api for python to get translations * fix: strip dumb prefix of content in translation * feat: extend meta diff for translations * feat: hook up translations to rebuild-from-disk * feat: generation of the website prefers project language, falling back to canonical language * fix: crashes during rendering * feat: translation validation report * fix: made the translation validation actually work * chore: reorganization of menu * fix: some topics cleanup * chore: updated doc * feat: translations for media * feat: more aligned in UI/UX * feat: edit translations possible * chore: added full multi-language todo * chore: updated todo for clarity * feat: implementation of full multi-linguality * fix: page creation creates pages * fix: flags on every page * fix: better prompt * feat: made MCP server aware of language content * feat: python tools for translations * fix: better fill-in-translations * fix: better prompt for translation. maybe. * fix: losing posts from search due to translation process * fix: translation validation handles in-db content and fill-in of missing translations fixed to flush * fix: faster scanning for infilling of missing translations * chore: updated agent instructions * feat: calendar and tag cloud respect current language now * fix: retries going up * fix: got metadata-diff and rebuild into sync * fix: extended meta-diff for timestamps * fix: made website validation look at translated content, too * fix: multi-lingual search * chore: refactor Editor.tsx into two separate editors * feat: do language detection when no explicit language given --------- Co-authored-by: hugo <hugoms@me.com>
122 lines
5.1 KiB
TypeScript
122 lines
5.1 KiB
TypeScript
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');
|
|
});
|
|
|
|
it('includes an API 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 === 'openApiDocumentation')).toBe(true);
|
|
});
|
|
|
|
it('maps API documentation to a renderer menu event', () => {
|
|
expect(APP_MENU_ACTION_EVENT_MAP.openApiDocumentation).toBe('menu:openApiDocumentation');
|
|
});
|
|
|
|
it('includes Open in Browser and Open Data Folder actions in File menu', () => {
|
|
const fileGroup = APP_MENU_GROUPS.find((group) => group.label === 'File');
|
|
|
|
expect(fileGroup).toBeDefined();
|
|
expect(fileGroup?.items.some((item) => item.action === 'openInBrowser')).toBe(true);
|
|
expect(fileGroup?.items.some((item) => item.action === 'openDataFolder')).toBe(true);
|
|
});
|
|
|
|
it('includes Preview Post action in Blog menu', () => {
|
|
const blogGroup = APP_MENU_GROUPS.find((group) => group.label === 'Blog');
|
|
|
|
expect(blogGroup).toBeDefined();
|
|
expect(blogGroup?.items.some((item) => item.action === 'previewPost')).toBe(true);
|
|
});
|
|
|
|
it('includes shared View actions for reload, zoom and fullscreen controls', () => {
|
|
const viewGroup = APP_MENU_GROUPS.find((group) => group.label === 'View');
|
|
|
|
expect(viewGroup).toBeDefined();
|
|
expect(viewGroup?.items.some((item) => item.action === 'reload')).toBe(true);
|
|
expect(viewGroup?.items.some((item) => item.action === 'forceReload')).toBe(true);
|
|
expect(viewGroup?.items.some((item) => item.action === 'resetZoom')).toBe(true);
|
|
expect(viewGroup?.items.some((item) => item.action === 'zoomIn')).toBe(true);
|
|
expect(viewGroup?.items.some((item) => item.action === 'zoomOut')).toBe(true);
|
|
expect(viewGroup?.items.some((item) => item.action === 'toggleFullScreen')).toBe(true);
|
|
});
|
|
|
|
it('includes Validate Site action in Blog menu with an L shortcut', () => {
|
|
const blogGroup = APP_MENU_GROUPS.find((group) => group.label === 'Blog');
|
|
const validateSiteItem = blogGroup?.items.find((item) => item.action === 'validateSite');
|
|
|
|
expect(validateSiteItem).toBeDefined();
|
|
expect(validateSiteItem?.accelerator).toContain('L');
|
|
});
|
|
|
|
it('maps Validate Site to a renderer menu event', () => {
|
|
expect(APP_MENU_ACTION_EVENT_MAP.validateSite).toBe('menu:validateSite');
|
|
});
|
|
|
|
it('includes Validate Translations action in Blog menu', () => {
|
|
const blogGroup = APP_MENU_GROUPS.find((group) => group.label === 'Blog');
|
|
|
|
expect(blogGroup).toBeDefined();
|
|
expect(blogGroup?.items.some((item) => item.action === 'validateTranslations')).toBe(true);
|
|
});
|
|
|
|
it('maps Validate Translations to a renderer menu event', () => {
|
|
expect(APP_MENU_ACTION_EVENT_MAP.validateTranslations).toBe('menu:validateTranslations');
|
|
});
|
|
|
|
it('includes Regenerate Calendar action in Blog menu', () => {
|
|
const blogGroup = APP_MENU_GROUPS.find((group) => group.label === 'Blog');
|
|
|
|
expect(blogGroup).toBeDefined();
|
|
expect(blogGroup?.items.some((item) => item.action === 'regenerateCalendar')).toBe(true);
|
|
});
|
|
|
|
it('maps Regenerate Calendar to a renderer menu event', () => {
|
|
expect(APP_MENU_ACTION_EVENT_MAP.regenerateCalendar).toBe('menu:regenerateCalendar');
|
|
});
|
|
|
|
it('includes Edit Preferences action in Edit menu with comma shortcut', () => {
|
|
const editGroup = APP_MENU_GROUPS.find((group) => group.label === 'Edit');
|
|
const preferencesItem = editGroup?.items.find((item) => item.action === 'editPreferences');
|
|
|
|
expect(preferencesItem).toBeDefined();
|
|
expect(preferencesItem?.accelerator).toContain(',');
|
|
});
|
|
|
|
it('maps Edit Preferences to a renderer menu event', () => {
|
|
expect(APP_MENU_ACTION_EVENT_MAP.editPreferences).toBe('menu:editPreferences');
|
|
});
|
|
|
|
it('includes Edit Menu action in Blog menu', () => {
|
|
const blogGroup = APP_MENU_GROUPS.find((group) => group.label === 'Blog');
|
|
|
|
expect(blogGroup).toBeDefined();
|
|
expect(blogGroup?.items.some((item) => item.action === 'editMenu')).toBe(true);
|
|
});
|
|
|
|
it('maps Edit Menu to a renderer menu event', () => {
|
|
expect(APP_MENU_ACTION_EVENT_MAP.editMenu).toBe('menu:editMenu');
|
|
});
|
|
|
|
it('includes Fill Missing Translations action in Blog menu', () => {
|
|
const blogGroup = APP_MENU_GROUPS.find((group) => group.label === 'Blog');
|
|
|
|
expect(blogGroup).toBeDefined();
|
|
expect(blogGroup?.items.some((item) => item.action === 'fillMissingTranslations')).toBe(true);
|
|
});
|
|
|
|
it('maps Fill Missing Translations to a renderer menu event', () => {
|
|
expect(APP_MENU_ACTION_EVENT_MAP.fillMissingTranslations).toBe('menu:fillMissingTranslations');
|
|
});
|
|
});
|