mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
2cda6decbe
Implements support for configuring both qBittorrent and SABnzbd simultaneously, including migration from legacy config, protocol-aware routing, and protocol filtering. Adds new CRUD API routes for download clients, new UI management components, and updates setup and settings flows to use the new multi-client architecture. Updates documentation to describe the new structure and usage.
32 lines
887 B
TypeScript
32 lines
887 B
TypeScript
/**
|
|
* Component: Modal Component Tests
|
|
* Documentation: documentation/frontend/components.md
|
|
*/
|
|
|
|
// @vitest-environment jsdom
|
|
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
import { Modal } from '@/components/ui/Modal';
|
|
|
|
describe('Modal', () => {
|
|
it('locks body scroll while open and closes on escape', () => {
|
|
const onClose = vi.fn();
|
|
|
|
const { unmount } = render(
|
|
<Modal isOpen onClose={onClose} title="Test Modal">
|
|
<div>Modal Content</div>
|
|
</Modal>
|
|
);
|
|
|
|
expect(screen.getByText('Modal Content')).toBeInTheDocument();
|
|
expect(document.body.style.overflow).toBe('hidden');
|
|
|
|
fireEvent.keyDown(document, { key: 'Escape' });
|
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
|
|
unmount();
|
|
expect(document.body.style.overflow).toBe(''); // Cleared to default
|
|
});
|
|
});
|