From 8022a9d70b682a986cd793720e829dd1e2599c5d Mon Sep 17 00:00:00 2001 From: likithayadav_g Date: Fri, 23 Jan 2026 12:34:18 +0530 Subject: [PATCH] feat(sign-up-page): implement sign-up page with form fields, validation, and Google sign-in option --- src/features/auth/SignUpPage.test.tsx | 85 ++++++++++++++++++++++ src/features/auth/SignUpPage.tsx | 100 ++++++++++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 src/features/auth/SignUpPage.test.tsx create mode 100644 src/features/auth/SignUpPage.tsx diff --git a/src/features/auth/SignUpPage.test.tsx b/src/features/auth/SignUpPage.test.tsx new file mode 100644 index 0000000..af697ef --- /dev/null +++ b/src/features/auth/SignUpPage.test.tsx @@ -0,0 +1,85 @@ +import { render, screen } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { describe, it } from "vitest"; +import { BrowserRouter } from "react-router-dom"; +import { SignUpPage } from "./SignUpPage"; + +const renderSignUpPage = () => { + return render( + + + , + ); +}; + +describe("SignUpPage", () => { + it("should render the email input field", () => { + renderSignUpPage(); + + expect(screen.getByLabelText(/email/i)).toBeInTheDocument(); + }); + + it("should render the password input field", () => { + renderSignUpPage(); + + expect(screen.getByLabelText(/^password$/i)).toBeInTheDocument(); + }); + + it("should render the confirm password input field", () => { + renderSignUpPage(); + + expect(screen.getByLabelText(/confirm password/i)).toBeInTheDocument(); + }); + + it("should allow typing in the email input", async () => { + renderSignUpPage(); + const user = userEvent.setup(); + + const emailInput = screen.getByLabelText(/email/i); + await user.type(emailInput, "test@example.com"); + + expect(emailInput).toHaveValue("test@example.com"); + }); + + it("should allow typing in the password input", async () => { + renderSignUpPage(); + const user = userEvent.setup(); + + const passwordInput = screen.getByLabelText(/^password$/i); + await user.type(passwordInput, "password123"); + + expect(passwordInput).toHaveValue("password123"); + }); + + it("should allow typing in the confirm password input", async () => { + renderSignUpPage(); + const user = userEvent.setup(); + + const confirmPasswordInput = screen.getByLabelText(/confirm password/i); + await user.type(confirmPasswordInput, "password123"); + + expect(confirmPasswordInput).toHaveValue("password123"); + }); + + it("should render the create account button", () => { + renderSignUpPage(); + + expect( + screen.getByRole("button", { name: /create account/i }), + ).toBeInTheDocument(); + }); + + it("should render the continue with google button", () => { + renderSignUpPage(); + + expect( + screen.getByRole("button", { name: /continue with google/i }), + ).toBeInTheDocument(); + }); + + it("should render the sign in link", () => { + renderSignUpPage(); + + expect(screen.getByRole("link", { name: /sign in/i })).toBeInTheDocument(); + }); +}); diff --git a/src/features/auth/SignUpPage.tsx b/src/features/auth/SignUpPage.tsx new file mode 100644 index 0000000..845a576 --- /dev/null +++ b/src/features/auth/SignUpPage.tsx @@ -0,0 +1,100 @@ +import { useState } from "react"; +import { Link } from "react-router-dom"; +import { Button } from "../../components/button/Button"; +import { Input } from "../../components/input/Input"; +import { Card, CardBody } from "../../components/card/Card"; +import { GoogleLogo } from "../../components/googlelogo/GoogleLogo"; + +export const SignUpPage = () => { + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [confirmPassword, setConfirmPassword] = useState(""); + + const handleSubmit = (event: React.FormEvent) => { + event.preventDefault(); + }; + + return ( +
+
+ + +
+

+ Create Account +

+

+ Join us to save and organize your resources +

+
+ +
+ setEmail(event.target.value)} + className="w-full" + required + autoComplete="off" + /> + + setPassword(event.target.value)} + className="w-full" + required + autoComplete="off" + /> + + setConfirmPassword(event.target.value)} + className="w-full" + required + autoComplete="off" + /> + + +
+ +
+
+
+
+
+ + Or sign up with + +
+
+ + + +

+ Already have an account? + + Sign in + +

+ + +
+
+ ); +};