Makelore 2.0 initial clean snapshot

This commit is contained in:
inman
2026-07-29 17:22:35 +08:00
commit b8ca3f8eea
694 changed files with 139782 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { describe, expect, it } from 'vitest';
import { getZoomShortcutAction } from '@electron/main/zoom-shortcuts';
function input(overrides: Partial<Electron.Input>): Electron.Input {
return {
type: 'keyDown',
key: '',
code: '',
isAutoRepeat: false,
shift: false,
control: false,
alt: false,
meta: false,
...overrides,
};
}
describe('zoom shortcuts', () => {
it('recognizes zoom in from plus and equal keys', () => {
expect(getZoomShortcutAction(input({ control: true, key: '+', code: 'Equal', shift: true }))).toBe('in');
expect(getZoomShortcutAction(input({ control: true, key: '=', code: 'Equal' }))).toBe('in');
expect(getZoomShortcutAction(input({ control: true, key: '+', code: 'NumpadAdd' }))).toBe('in');
});
it('recognizes zoom out and reset shortcuts', () => {
expect(getZoomShortcutAction(input({ control: true, key: '-', code: 'Minus' }))).toBe('out');
expect(getZoomShortcutAction(input({ control: true, key: '-', code: 'NumpadSubtract' }))).toBe('out');
expect(getZoomShortcutAction(input({ control: true, key: '0', code: 'Digit0' }))).toBe('reset');
});
it('requires a command modifier without alt', () => {
expect(getZoomShortcutAction(input({ key: '+', code: 'Equal' }))).toBeNull();
expect(getZoomShortcutAction(input({ control: true, alt: true, key: '+', code: 'Equal' }))).toBeNull();
expect(getZoomShortcutAction(input({ meta: true, key: '+', code: 'Equal' }))).toBe('in');
});
});