From dbaae5ae1ff997d3f52da4f810902022c9b53a0e Mon Sep 17 00:00:00 2001 From: Joe Winter Date: Thu, 24 Oct 2024 16:22:33 +0100 Subject: [PATCH] show show show me your tests --- frontend/src/components/Clipboard.jsx | 24 +++++++-- frontend/src/components/Copied.jsx | 1 + .../src/components/CopyToClipboardButton.jsx | 12 +---- frontend/src/pages/Lobby.jsx | 7 ++- .../components/copyToClipboardButton.test.jsx | 51 +++++++++++++++++++ frontend/vite.config.js | 3 +- 6 files changed, 79 insertions(+), 19 deletions(-) create mode 100644 frontend/tests/components/copyToClipboardButton.test.jsx diff --git a/frontend/src/components/Clipboard.jsx b/frontend/src/components/Clipboard.jsx index 1d6b636..361dc83 100644 --- a/frontend/src/components/Clipboard.jsx +++ b/frontend/src/components/Clipboard.jsx @@ -1,8 +1,22 @@ -export default function CheckMark() { +export default function Clipboard() { return ( - - + ); } diff --git a/frontend/src/components/Copied.jsx b/frontend/src/components/Copied.jsx index d71f2ef..d48926f 100644 --- a/frontend/src/components/Copied.jsx +++ b/frontend/src/components/Copied.jsx @@ -1,6 +1,7 @@ export default function Copied() { return (
@@ -37,4 +28,3 @@ const CopyToClipboardButton = ({ content }) => { ); }; -export default CopyToClipboardButton; diff --git a/frontend/src/pages/Lobby.jsx b/frontend/src/pages/Lobby.jsx index fc9eb65..4dfc380 100644 --- a/frontend/src/pages/Lobby.jsx +++ b/frontend/src/pages/Lobby.jsx @@ -7,12 +7,13 @@ import { ListPlayers } from "../components/ListPlayers"; import { Card } from "../components/Card"; import { Header } from "../components/Header"; import { Footer } from "../components/Footer"; -import CopyToClipboardButton from "../components/CopyToClipboardButton"; +import { CopyToClipboardButton } from "../components/CopyToClipboardButton"; import { H1 } from "../components/H1"; -import { useEffect } from "react"; +import { useEffect, useState } from "react"; export function Lobby({ gameState, isHost, redirect, setRedirect}) { const navigate = useNavigate(); + const [isCopied, setIsCopied] = useState(false) const handleClick = () => { socket.emit("start_game"); @@ -38,6 +39,8 @@ export function Lobby({ gameState, isHost, redirect, setRedirect}) {

Share your game link: