Reader: Highlights button in the top bar
A highlighter button beside Bookmarks opens your highlights (by colour); Bookmarks now opens the bookmarks. Each shows in the accent colour when you have some. "H" opens the highlights. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
22f9700798
commit
a9ca647d5a
6 files changed
+45
-9
No files matched your search
@@ -117,6 +117,31 @@ test('tapping a verse colour again takes it off, and Clear removes them all (wit
|
||||
Object.assign(ctx, saved);
|
||||
});
|
||||
|
||||
test('a Highlights button sits in the top bar and opens the highlights; Bookmarks opens the bookmarks', () => {
|
||||
const saved = { ...ctx };
|
||||
Object.assign(ctx, {
|
||||
readerTextHighlights: [{ id: 'h1', book: 'JHN', chapter: 3, verse: 2, startOffset: 0, endOffset: 4, color: '#bbf7d0', text: 'This' }],
|
||||
readerBookmarks: { 'JHN-3-1': '#fef08a' },
|
||||
});
|
||||
render(<ReaderPage />);
|
||||
const highlights = screen.getByLabelText('Highlights');
|
||||
expect(highlights.nextElementSibling).toBe(screen.getByLabelText('Bookmarks')); // beside the bookmarks button
|
||||
fireEvent.click(highlights);
|
||||
expect(screen.getByRole('tab', { name: /highlights \(1\)/i })).toHaveAttribute('aria-selected', 'true');
|
||||
expect(screen.getByText(/“This”/)).toBeTruthy();
|
||||
fireEvent.click(screen.getByLabelText('Close'));
|
||||
fireEvent.click(screen.getByLabelText('Bookmarks'));
|
||||
expect(screen.getByRole('tab', { name: /bookmarks \(1\)/i })).toHaveAttribute('aria-selected', 'true');
|
||||
expect(screen.getByText('John 3:1')).toBeTruthy();
|
||||
Object.assign(ctx, saved);
|
||||
});
|
||||
|
||||
test('the H key opens the highlights', () => {
|
||||
render(<ReaderPage />);
|
||||
fireEvent.keyDown(window, { key: 'h' });
|
||||
expect(screen.getByRole('dialog', { name: /bookmarks & highlights/i })).toBeTruthy();
|
||||
});
|
||||
|
||||
test('tapping a verse selects it', () => {
|
||||
render(<ReaderPage />);
|
||||
fireEvent.click(screen.getByText(/This man came to Jesus/));
|
||||
|
||||
Reference in new issue
Block a user