mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
31bca0052f
Introduces 'series' and 'seriesPart' fields to the Audiobook model and database schema. Updates API routes, file organization, and path template utilities to support series metadata. Enhances chapter merging logic, improves notification backend testing, and expands test coverage for admin and API routes.
32 lines
870 B
TypeScript
32 lines
870 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('unset');
|
|
});
|
|
});
|