fix: macosx UI cleanup

This commit is contained in:
2026-02-19 22:50:21 +01:00
parent 7e593b587b
commit 0d66939eb7
8 changed files with 333 additions and 176 deletions

View File

@@ -19,7 +19,7 @@ describe('WindowTitleBar', () => {
});
});
it('applies a macOS class to the title bar root for platform-specific spacing', () => {
it('renders title bar on macOS but hides simulated menu buttons', () => {
Object.defineProperty(navigator, 'platform', {
value: 'MacIntel',
configurable: true,
@@ -27,10 +27,14 @@ describe('WindowTitleBar', () => {
render(<WindowTitleBar />);
expect(screen.getByTestId('window-titlebar')).toHaveClass('is-mac');
expect(screen.getByTestId('window-titlebar')).toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'File' })).toBeNull();
expect(screen.queryByRole('button', { name: 'Edit' })).toBeNull();
expect(screen.getByLabelText('Toggle Sidebar')).toBeInTheDocument();
expect(screen.getByLabelText('Toggle Panel')).toBeInTheDocument();
});
it('sets macOS title bar inset CSS variable from dynamic native metrics', async () => {
it('does not request macOS title bar metrics when simulated title bar is disabled', async () => {
Object.defineProperty(navigator, 'platform', {
value: 'MacIntel',
configurable: true,
@@ -48,8 +52,8 @@ describe('WindowTitleBar', () => {
await Promise.resolve();
});
expect(getTitleBarMetrics).toHaveBeenCalled();
expect(document.documentElement.style.getPropertyValue('--bds-titlebar-macos-left-inset')).toBe('102px');
expect(getTitleBarMetrics).not.toHaveBeenCalled();
expect(document.documentElement.style.getPropertyValue('--bds-titlebar-macos-left-inset')).toBe('');
});
it('renders a right-side sidebar toggle button and toggles store state', () => {

View File

@@ -12,4 +12,31 @@ describe('Help menu documentation entry', () => {
it('maps Open Documentation to a renderer menu event', () => {
expect(APP_MENU_ACTION_EVENT_MAP.openDocumentation).toBe('menu:openDocumentation');
});
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);
});
});