fix: wire orphaned IPC channels, fix data-loss bug, print preview events, sidebar navigation

- Fix file.clearRecent sending IPC to main process instead of clearing openTabs
- Wire show-batch-converter, show-document-compare, open-header-footer-dialog IPC channels
- Add print preview event listeners (mc:print-preview, mc:print-preview-styled) in App.tsx
- Fix sidebar hidden bridge buttons toggling sidebar closed after scroll
- Update sidebar menu labels to match actual sections (Files, Outline, Git)
- Fix ipc.print to be an object with show/doPrint methods (was bare function)
- Update callers: ExportPdfDialog, pdf-export, PrintPreview
- Add 7 regression tests for all fixes
- Clean 2 obsolete snapshots
- Build Linux packages (deb, AppImage, snap) — 549 tests passing
This commit is contained in:
2026-06-11 07:15:33 +05:30
parent e25a5e1d75
commit cf6b6817b9
11 changed files with 179 additions and 24 deletions
@@ -8,7 +8,10 @@ import { useSettingsStore } from '@/stores/settings-store';
vi.mock('@/lib/ipc', () => ({
ipc: {
print: vi.fn().mockResolvedValue({ ok: true }),
print: {
show: vi.fn().mockResolvedValue({ ok: true }),
doPrint: vi.fn().mockResolvedValue({ ok: true }),
},
},
}));
@@ -29,12 +32,12 @@ describe('ExportPdfDialog', () => {
expect(screen.getByRole('combobox', { name: /format/i })).toBeInTheDocument();
});
it('toggles ASCII tables and submits via ipc.print', async () => {
it('toggles ASCII tables and submits via ipc.print.show', async () => {
render(<ExportPdfDialog sourcePath="/test.md" />);
await userEvent.click(screen.getByRole('checkbox', { name: /ascii/i }));
await userEvent.click(screen.getByRole('button', { name: /^export$/i }));
await waitFor(() => expect(ipc.print).toHaveBeenCalledTimes(1));
const [arg] = (ipc.print as any).mock.calls[0];
await waitFor(() => expect(ipc.print.show).toHaveBeenCalledTimes(1));
const [arg] = (ipc.print.show as any).mock.calls[0];
expect(arg.html).toContain('<!DOCTYPE html>');
// The Markdown source is rendered to HTML inside the document body.
expect(arg.html).toContain('<h1>hi</h1>');
@@ -43,7 +46,7 @@ describe('ExportPdfDialog', () => {
});
it('renders an error banner when IPC fails', async () => {
(ipc.print as any).mockRejectedValueOnce(new Error('Pandoc not found'));
(ipc.print.show as any).mockRejectedValueOnce(new Error('Pandoc not found'));
render(<ExportPdfDialog sourcePath="/test.md" />);
await userEvent.click(screen.getByRole('button', { name: /^export$/i }));
expect(await screen.findByText(/pandoc not found/i)).toBeInTheDocument();