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 + +

+ + +
+
+ ); +};