mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-03 02:11:07 +05:30
- WelcomeDialog: add quick start, feature showcase, keyboard shortcuts, recent files, version display - ExportDocxDialog/ExportHtmlDialog/ExportPdfDialog: add header/footer, paper size, margin controls - GitStatusPanel: full staging/unstaging, discard, commit workflow - CommandPalette: fuzzy command search with keyboard navigation - FindReplaceBar: find/replace with regex, case, whole-word options - New dialogs: BatchMediaConverterDialog, HeaderFooterDialog, PdfEditorDialog, UniversalConverterDialog - Tests: comprehensive coverage for all new/updated components
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { describe, it, expect, beforeEach } from 'vitest';
|
|
import { render, screen } from '@testing-library/react';
|
|
import { ModalLayer } from '@/components/modals/ModalLayer';
|
|
import { useAppStore } from '@/stores/app-store';
|
|
|
|
describe('ModalLayer', () => {
|
|
beforeEach(() => {
|
|
localStorage.clear();
|
|
useAppStore.setState({ modal: { kind: null } } as any);
|
|
});
|
|
|
|
it('renders nothing when modal is null', () => {
|
|
const { container } = render(<ModalLayer />);
|
|
expect(container.firstChild).toBeNull();
|
|
});
|
|
|
|
it('renders AboutDialog when kind is "about"', () => {
|
|
useAppStore.getState().openModal('about');
|
|
render(<ModalLayer />);
|
|
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
});
|
|
|
|
it('switches from about to settings when modal kind changes', () => {
|
|
useAppStore.getState().openModal('about');
|
|
const { rerender } = render(<ModalLayer />);
|
|
expect(screen.getByText(/about markdownconverter/i)).toBeInTheDocument();
|
|
useAppStore.getState().openModal('settings');
|
|
rerender(<ModalLayer />);
|
|
expect(screen.queryByText(/about markdownconverter/i)).not.toBeInTheDocument();
|
|
expect(screen.getByText(/settings/i)).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders BatchMediaConverterDialog when kind is "batch-media-converter"', () => {
|
|
useAppStore.getState().openModal('batch-media-converter');
|
|
render(<ModalLayer />);
|
|
expect(screen.getByText(/batch media converter/i)).toBeInTheDocument();
|
|
});
|
|
});
|