From 2f3583212f470f454a8bd4942a36742be92ad62b Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Tue, 17 Feb 2026 20:32:58 +0900
Subject: test(frontend): add comprehensive tests for components, hooks, and
 state

Add 84 new tests covering Jotai atoms (play/watch state transitions,
game timing, score management), utility functions (calcCodeSize,
checkGameResultKind), UI components (SubmitStatusLabel, LeftTime,
SubmitButton, InputText, BorderedContainerWithCaption,
FoldableBorderedContainerWithCaption, UserIcon, PlayerNameAndIcon),
and the usePageTitle hook.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---
 frontend/app/components/InputText.test.tsx | 36 ++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 frontend/app/components/InputText.test.tsx

(limited to 'frontend/app/components/InputText.test.tsx')

diff --git a/frontend/app/components/InputText.test.tsx b/frontend/app/components/InputText.test.tsx
new file mode 100644
index 0000000..2072b37
--- /dev/null
+++ b/frontend/app/components/InputText.test.tsx
@@ -0,0 +1,36 @@
+/**
+ * @vitest-environment jsdom
+ */
+import { cleanup, render, screen } from "@testing-library/react";
+import { afterEach, describe, expect, test } from "vitest";
+import InputText from "./InputText";
+
+afterEach(() => {
+	cleanup();
+});
+
+describe("InputText", () => {
+	test("renders an input element", () => {
+		render(<InputText data-testid="input" />);
+		const input = screen.getByTestId("input");
+		expect(input.tagName).toBe("INPUT");
+	});
+
+	test("passes placeholder prop", () => {
+		render(<InputText placeholder="Enter text" data-testid="input" />);
+		const input = screen.getByTestId("input") as HTMLInputElement;
+		expect(input.placeholder).toBe("Enter text");
+	});
+
+	test("passes type prop", () => {
+		render(<InputText type="password" data-testid="input" />);
+		const input = screen.getByTestId("input") as HTMLInputElement;
+		expect(input.type).toBe("password");
+	});
+
+	test("has border styling", () => {
+		render(<InputText data-testid="input" />);
+		const input = screen.getByTestId("input");
+		expect(input.className).toContain("border-sky-600");
+	});
+});
-- 
cgit v1.3.1

