From 237d74a9277913cf93b6efb205ab132f26502370 Mon Sep 17 00:00:00 2001 From: Josh Larson Date: Tue, 14 May 2024 11:02:53 -0400 Subject: [PATCH] feat: Direct `About Skate` clicks to the /user-guide endpoint (#2593) --- assets/src/components/nav/leftNav.tsx | 11 +++++------ assets/src/components/nav/navMenu.tsx | 11 +++++------ .../components/__snapshots__/app.test.tsx.snap | 6 ++++-- .../appStateWrapper.test.tsx.snap | 6 ++++-- assets/tests/components/nav/leftNav.test.tsx | 14 -------------- assets/tests/components/nav/navMenu.test.tsx | 18 +----------------- 6 files changed, 19 insertions(+), 47 deletions(-) diff --git a/assets/src/components/nav/leftNav.tsx b/assets/src/components/nav/leftNav.tsx index 32a8f7361..aa74d4a5f 100644 --- a/assets/src/components/nav/leftNav.tsx +++ b/assets/src/components/nav/leftNav.tsx @@ -1,7 +1,6 @@ import React, { useState, useContext } from "react" -import { NavLink, useLocation } from "react-router-dom" +import { NavLink } from "react-router-dom" import { StateDispatchContext } from "../../contexts/stateDispatchContext" -import { displayHelp } from "../../helpers/appCue" import { openDrift } from "../../helpers/drift" import { tagManagerEvent } from "../../helpers/googleTagManager" import NotificationBellIcon from "../notificationBellIcon" @@ -65,7 +64,6 @@ const LeftNav = ({ } = usePanelStateFromStateDispatchContext() const [collapsed, setCollapsed] = useState(defaultToCollapsed) - const location = useLocation() const bellIconClasses = openView == OpenView.NotificationDrawer @@ -180,14 +178,15 @@ const LeftNav = ({
  • - +
  • = ({ mobileMenuIsOpen, toggleMobileMenu }) => { { - displayHelp(location) - toggleMobileMenu() - }} > About Skate diff --git a/assets/tests/components/__snapshots__/app.test.tsx.snap b/assets/tests/components/__snapshots__/app.test.tsx.snap index 238e49756..729f65cf1 100644 --- a/assets/tests/components/__snapshots__/app.test.tsx.snap +++ b/assets/tests/components/__snapshots__/app.test.tsx.snap @@ -181,8 +181,10 @@ exports[`App renders 1`] = `
  • - +
  • - +
  • { expect(openDrift).toHaveBeenCalled() }) - test("clicking About Skate button displays help", async () => { - const user = userEvent.setup() - const result = render( - - - - ) - - await user.click(result.getByTitle("About Skate")) - - expect(displayHelp).toHaveBeenCalled() - }) - test("clicking notifications icon toggles notifications drawer and logs a tag manager event", async () => { const mockedUsePanelState = mockUsePanelState() const user = userEvent.setup() diff --git a/assets/tests/components/nav/navMenu.test.tsx b/assets/tests/components/nav/navMenu.test.tsx index 8519c396f..c0cd5be67 100644 --- a/assets/tests/components/nav/navMenu.test.tsx +++ b/assets/tests/components/nav/navMenu.test.tsx @@ -5,7 +5,6 @@ import userEvent from "@testing-library/user-event" import "@testing-library/jest-dom/jest-globals" import * as browser from "../../../src/models/browser" import { openDrift } from "../../../src/helpers/drift" -import { displayHelp } from "../../../src/helpers/appCue" import NavMenu from "../../../src/components/nav/navMenu" import { BrowserRouter } from "react-router-dom" import getTestGroups from "../../../src/userTestGroups" @@ -197,21 +196,6 @@ describe("NavMenu", () => { expect(toggleMobileMenu).toHaveBeenCalled() }) - test("clicking About Skate button displays help", async () => { - const toggleMobileMenu = jest.fn() - - const user = userEvent.setup() - const result = render( - - - - ) - - await user.click(result.getByRole("button", { name: "About Skate" })) - - expect(displayHelp).toHaveBeenCalled() - }) - test("clicking the About button closes the mobile menu", async () => { const toggleMobileMenu = jest.fn() @@ -222,7 +206,7 @@ describe("NavMenu", () => { ) - await user.click(result.getByRole("button", { name: "About Skate" })) + await user.click(result.getByRole("link", { name: "About Skate" })) expect(toggleMobileMenu).toHaveBeenCalled() })