diff --git a/src/Home/Home.test.tsx b/src/Home/Home.test.tsx deleted file mode 100644 index 072609a..0000000 --- a/src/Home/Home.test.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { fireEvent, render, screen } from "@testing-library/react"; -import Home from "./Home"; -import "@testing-library/jest-dom"; -import React, { useState } from "react"; - -test.skip("user's name is displayed on form submission", () => { - const name = "Luigi"; - const [username, setUsername] = useState(name); - - render(); - - const textArea = screen.getByLabelText(/Enter name:/); - fireEvent.change(textArea, { target: { value: name }}); - - const submitButton = screen.getByRole("button"); - fireEvent.click(submitButton); - - const welcomeMessage = screen.getByText(/Welcome Luigi!/i); - expect(welcomeMessage).toBeInTheDocument(); -}) \ No newline at end of file diff --git a/src/Home/Home.tsx b/src/Home/Home.tsx index 418e34d..c6a1596 100644 --- a/src/Home/Home.tsx +++ b/src/Home/Home.tsx @@ -3,14 +3,13 @@ import { useNavigate } from "react-router-dom"; import DisplayBackgroundImage from '../images/DisplayBackgroundImage'; import './Home.scss' -interface getUserProp{ +interface HomeProps{ username:string; setUsername:(uname:string)=>void; } -function Home(props:getUserProp) { +function Home(props:HomeProps) { - //const [username, setUsername] = useState(""); const [submitStatus, setSubmitStatus] = useState(false); const handleSubmit = (event: React.FormEvent) => { @@ -29,24 +28,20 @@ function Home(props:getUserProp) { return ( <>
- {/* Other components and content */}
{submitStatus ?

Welcome {props.username}!

: null}
- -
) diff --git a/src/Quiz/Quiz.tsx b/src/Quiz/Quiz.tsx index d54f1fd..1d01719 100644 --- a/src/Quiz/Quiz.tsx +++ b/src/Quiz/Quiz.tsx @@ -1,10 +1,10 @@ import { QuestionDisplay } from "../QuestionDisplay/QuestionDisplay" -interface getUserProp{ +interface QuizProps{ username:string; } -export function Quiz (props:getUserProp) { +export function Quiz (props:QuizProps) { return (
User : {props.username}