Build and Push Docker Image / build-and-push (push) Successful in 6m47s
- Admin: sign-up Open / Invite only / Closed with single-use invite links - Present mode for scripts (auto-scroll) and outlines (step through, pace vs planned minutes) - Series: group studies on the dashboard, filter by series, calendar file for a study's sessions - Lesson handout: printable page per session (passage, outline, questions, writing lines) - Save a chunk's notes as your own study template (synced) - Voice dictation for notes and scripts (browser speech recognition) - Reading progress: map of the 66 books and a calendar of days read, synced and merged across devices - Export highlights and bookmarks as Markdown or Word, grouped by named colour - Verse of the day push to the ntfy topic (needs IQBIBLE_API_KEY) - Sharing: co-teacher editing via single-use invite links; read-only links can expire and take a passcode Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
30 lines
1.7 KiB
React
30 lines
1.7 KiB
React
import { render, screen } from '@testing-library/react';
|
|
import userEvent from '@testing-library/user-event';
|
|
import { vi, test, expect } from 'vitest';
|
|
|
|
vi.mock('../../utils/marksExport.js', async (orig) => ({ ...(await orig()), downloadMarksFile: vi.fn() }));
|
|
import MarksSheet from './MarksSheet.jsx';
|
|
import { downloadMarksFile } from '../../utils/marksExport.js';
|
|
|
|
const base = { open: true, onClose: () => {}, colorLabels: { '#bbf7d0': 'Promises' }, onSetLabel: () => {}, onJump: () => {}, onRemoveBookmark: () => {}, onRemoveHighlight: () => {} };
|
|
const highlights = [{ id: 'h', color: '#bbf7d0', book: 'JHN', bookName: 'John', bookIndex: 42, chapter: 3, verse: 16, startOffset: 0, endOffset: 5, text: 'For God' }];
|
|
|
|
test('highlights and bookmarks can be exported as Markdown, named by your colour names', async () => {
|
|
const user = userEvent.setup();
|
|
render(<MarksSheet {...base} bookmarks={[]} highlights={highlights} />);
|
|
await user.click(screen.getByRole('button', { name: 'Markdown' }));
|
|
const [blob, name] = downloadMarksFile.mock.calls[0];
|
|
expect(name).toBe('highlights-and-bookmarks.md');
|
|
expect(await blob.text()).toContain('## Promises (green)');
|
|
});
|
|
|
|
test('Word export is offered too, and nothing to export means no buttons', async () => {
|
|
const user = userEvent.setup();
|
|
const { rerender } = render(<MarksSheet {...base} bookmarks={[]} highlights={highlights} />);
|
|
await user.click(screen.getByRole('button', { name: 'Word (.docx)' }));
|
|
await vi.waitFor(() => expect(downloadMarksFile).toHaveBeenCalledTimes(2));
|
|
expect(downloadMarksFile.mock.calls[1][1]).toBe('highlights-and-bookmarks.docx');
|
|
rerender(<MarksSheet {...base} bookmarks={[]} highlights={[]} />);
|
|
expect(screen.queryByRole('group', { name: /export your marks/i })).toBeNull();
|
|
});
|