+
{entry.title}
@@ -231,7 +247,7 @@ export default function HomePage() {
)}
{formatRelativeDate(entry.lastEdited)}
+
diff --git a/src/test/App.home.test.jsx b/src/test/App.home.test.jsx
index f7aa04d..ca2a6d4 100644
--- a/src/test/App.home.test.jsx
+++ b/src/test/App.home.test.jsx
@@ -27,6 +27,25 @@ describe('Home page', () => {
localStorage.setItem('bible-study-index', JSON.stringify(index));
}
+ test('studies can be shown as a grid or a list, and the choice is remembered', async () => {
+ seedProject();
+ seedProject({ id: 'p2', title: 'Second Study' });
+ const user = userEvent.setup();
+ const { unmount } = render(
);
+ await waitFor(() => expect(screen.queryByText('Loading…')).not.toBeInTheDocument());
+ const layout = screen.getByRole('group', { name: /studies layout/i });
+ expect(within(layout).getByRole('button', { name: 'Grid' })).toHaveAttribute('aria-pressed', 'true');
+ expect(screen.getByRole('heading', { name: 'Titus Notes' }).closest('.sm\\:grid-cols-2')).not.toBeNull();
+ await user.click(within(layout).getByRole('button', { name: 'List' }));
+ expect(within(layout).getByRole('button', { name: 'List' })).toHaveAttribute('aria-pressed', 'true');
+ expect(screen.getByRole('heading', { name: 'Titus Notes' }).closest('.sm\\:grid-cols-2')).toBeNull();
+ expect(screen.getAllByRole('button', { name: 'Resume' })).toHaveLength(2); // everything is still there
+ expect(localStorage.getItem('homeView')).toBe('list');
+ unmount();
+ await renderApp(); // reopening keeps the list
+ expect(within(screen.getByRole('group', { name: /studies layout/i })).getByRole('button', { name: 'List' })).toHaveAttribute('aria-pressed', 'true');
+ });
+
test('searching 3+ characters finds matches inside study notes', async () => {
seedProject();
const user = userEvent.setup();