fix: updated UI to macosx conventions

This commit is contained in:
2026-02-17 19:53:27 +01:00
parent a897a35b74
commit 9b54ba6ffb
7 changed files with 161 additions and 2 deletions

View File

@@ -19,6 +19,9 @@ vi.mock('electron', () => ({
app: {
quit: vi.fn(),
},
BrowserWindow: {
fromWebContents: vi.fn(),
},
ipcMain: {
handle: vi.fn((channel: string, handler: (...args: any[]) => Promise<any>) => {
registeredHandlers.set(channel, handler);
@@ -1344,6 +1347,25 @@ describe('IPC Handlers', () => {
});
});
describe('app:getTitleBarMetrics', () => {
it('should return dynamic macOS title bar left inset from native window button position', async () => {
const { BrowserWindow } = await import('electron');
const sender = {};
const event = { sender };
vi.mocked(BrowserWindow.fromWebContents).mockReturnValue({
getWindowButtonPosition: vi.fn(() => ({ x: 14, y: 14 })),
} as unknown as ReturnType<typeof BrowserWindow.fromWebContents>);
const result = await invokeHandlerWithEvent(event, 'app:getTitleBarMetrics');
expect(BrowserWindow.fromWebContents).toHaveBeenCalledWith(sender);
expect(result).toEqual({
macosLeftInset: 78,
});
});
});
describe('app:triggerMenuAction', () => {
it('should forward custom titlebar action to renderer menu channel', async () => {
const send = vi.fn();