From 04c449e8f207c1874c13c88a96ae7fe4a1e640ba Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sun, 1 Feb 2026 12:04:06 +0900
Subject: feat(study): add Space key as Good rating shortcut when card is
 flipped

Allow continuous study flow by pressing Space repeatedly - first to
flip the card, then to rate as Good (3).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---
 src/client/pages/StudyPage.test.tsx | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

(limited to 'src/client/pages/StudyPage.test.tsx')

diff --git a/src/client/pages/StudyPage.test.tsx b/src/client/pages/StudyPage.test.tsx
index dfadea9..68a7bb3 100644
--- a/src/client/pages/StudyPage.test.tsx
+++ b/src/client/pages/StudyPage.test.tsx
@@ -518,6 +518,32 @@ describe("StudyPage", () => {
 			);
 		});
 
+		it("rates card as Good with Space key when card is flipped", async () => {
+			const user = userEvent.setup();
+
+			mockStudyPost.mockResolvedValue({
+				card: { ...mockFirstCard, reps: 1 },
+			});
+
+			renderWithProviders({
+				initialStudyData: { deck: mockDeck, cards: mockDueCards },
+			});
+
+			await user.keyboard(" "); // Flip
+			await user.keyboard(" "); // Rate as Good (Space)
+
+			await waitFor(() => {
+				expect(screen.getByTestId("card-front").textContent).toBe("Goodbye");
+			});
+
+			expect(mockStudyPost).toHaveBeenCalledWith(
+				expect.objectContaining({
+					param: { deckId: "deck-1", cardId: "card-1" },
+					json: expect.objectContaining({ rating: 3 }),
+				}),
+			);
+		});
+
 		it("supports all rating keys (1, 2, 3, 4)", async () => {
 			const user = userEvent.setup();
 
-- 
cgit v1.3-1-g0d28

