diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index e5aed7d50..a5fb8a8c7 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -111,6 +111,9 @@ const Header = ({ logoPath, locale }: Props) => { setIsMobileNavExpanded(!isMobileNavExpanded); }; + const title = + usePathname() === "/" ? t("title") : {t("title")}; + return ( <>
{ /> )} - {t("title")} + {title}
{ expect(searchLink).toBeInTheDocument(); expect(searchLink).toHaveAttribute("href", "/search?refresh=true"); }); + + it("displays a home link if not on home page", () => { + render(
); + + const homeLink = screen.getByRole("link", { name: "Simpler.Grants.gov" }); + expect(homeLink).toBeInTheDocument(); + expect(homeLink).toHaveAttribute("href", "/"); + }); + + it("display text without a home link if on home page", () => { + mockedPath = "/"; + render(
); + + const homeText = screen.getByText("Simpler.Grants.gov"); + expect(homeText).toBeInTheDocument(); + expect(homeText).not.toHaveAttribute("href", "/"); + }); });