From 2c312e536015fa16b2075075f08e5ac2e255680d Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Wed, 23 Oct 2024 16:45:41 +0100 Subject: [PATCH] fix test --- frontend/src/components/H1.jsx | 8 ++++---- frontend/src/pages/LandingHost.jsx | 6 ------ frontend/src/pages/LandingPlayer.jsx | 10 +--------- frontend/tests/pages/InGame.test.jsx | 2 +- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/frontend/src/components/H1.jsx b/frontend/src/components/H1.jsx index e6538cf..fdf1474 100644 --- a/frontend/src/components/H1.jsx +++ b/frontend/src/components/H1.jsx @@ -1,7 +1,7 @@ export const H1 = ({ children }) => { return ( -

- { children } -

- ) +

+ { children } +

+ ); } \ No newline at end of file diff --git a/frontend/src/pages/LandingHost.jsx b/frontend/src/pages/LandingHost.jsx index e8b26b9..b8b9a1a 100644 --- a/frontend/src/pages/LandingHost.jsx +++ b/frontend/src/pages/LandingHost.jsx @@ -22,12 +22,6 @@ export function LandingHost() { const [error, setError] = useState(""); - //user cna type in the form - const handleInputChange = (e) => { - const value = e.target.value; - setInput(value); - }; - //click should redirect the user to the lobby const handleClick = (e) => { e.preventDefault(); diff --git a/frontend/src/pages/LandingPlayer.jsx b/frontend/src/pages/LandingPlayer.jsx index 3ac73d0..95be9d0 100644 --- a/frontend/src/pages/LandingPlayer.jsx +++ b/frontend/src/pages/LandingPlayer.jsx @@ -8,6 +8,7 @@ import { CardText } from "../components/CardText" import { Card } from "../components/Card" import { Header } from "../components/Header"; import { Footer } from "../components/Footer"; +import { H1 } from "../components/H1" // landing page when a user clicks on a link generated by the host to join a game @@ -19,16 +20,8 @@ export function LandingPlayer() { const params = useParams() const navigate = useNavigate() - - //user cna type in the form - const handleInputChange = (e) => { - const value = e.target.value; - setInput(value); - } - //click should redirect the user to the lobby const handleClick = (e) => { - e.preventDefault(); // Validate if the input is not empty @@ -69,7 +62,6 @@ export function LandingPlayer() { input={input} error={error} setInput={setInput} - handleInputChange={handleInputChange} avatar={avatar} setAvatar={setAvatar} > diff --git a/frontend/tests/pages/InGame.test.jsx b/frontend/tests/pages/InGame.test.jsx index a897e1e..61aec20 100644 --- a/frontend/tests/pages/InGame.test.jsx +++ b/frontend/tests/pages/InGame.test.jsx @@ -48,7 +48,7 @@ describe("InGame tests", () => { render( ); - const heading = screen.getByTestId("guess-label"); + const heading = screen.getByTestId("game-name"); expect(heading.textContent).toEqual("Poké Poké Guess Weight!"); }); test("given a list of players, they are visible", () => {