Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Direct About Skate clicks to the /user-guide endpoint #2593

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions assets/src/components/nav/leftNav.tsx
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -65,7 +64,6 @@ const LeftNav = ({
} = usePanelStateFromStateDispatchContext()

const [collapsed, setCollapsed] = useState<boolean>(defaultToCollapsed)
const location = useLocation()

const bellIconClasses =
openView == OpenView.NotificationDrawer
Expand Down Expand Up @@ -180,14 +178,15 @@ const LeftNav = ({
</button>
</li>
<li>
<button
<a
className="c-left-nav__link"
onClick={() => displayHelp(location)}
title="About Skate"
target="_blank"
href="/user-guide"
>
<QuestionMarkIcon className="c-left-nav__icon" />
About Skate
</button>
</a>
</li>
<li>
<NavLink
Expand Down
11 changes: 5 additions & 6 deletions assets/src/components/nav/navMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react"
import { Link } from "react-router-dom"
import { Nav } from "react-bootstrap"
import { displayHelp } from "../../helpers/appCue"
import { openDrift } from "../../helpers/drift"
import { OldCloseIcon, LogoIcon } from "../../helpers/icon"
import * as BsIcon from "../../helpers/bsIcons"
Expand Down Expand Up @@ -76,12 +75,12 @@ const NavMenu: React.FC<Props> = ({ mobileMenuIsOpen, toggleMobileMenu }) => {
</Nav.Item>
<Nav.Item>
<Nav.Link
as={Link}
onClick={toggleMobileMenu}
title="About Skate"
to="/user-guide"
target="_blank"
className="icon-link"
as="button"
onClick={() => {
displayHelp(location)
toggleMobileMenu()
}}
>
<BsIcon.QuestionFill /> About Skate
</Nav.Link>
Expand Down
6 changes: 4 additions & 2 deletions assets/tests/components/__snapshots__/app.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ exports[`App renders 1`] = `
</button>
</li>
<li>
<button
<a
class="c-left-nav__link"
href="/user-guide"
target="_blank"
title="About Skate"
>
<span
Expand All @@ -191,7 +193,7 @@ exports[`App renders 1`] = `
<svg />
</span>
About Skate
</button>
</a>
</li>
<li>
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ exports[`renders 1`] = `
</button>
</li>
<li>
<button
<a
class="c-left-nav__link"
href="/user-guide"
target="_blank"
title="About Skate"
>
<span
Expand All @@ -191,7 +193,7 @@ exports[`renders 1`] = `
<svg />
</span>
About Skate
</button>
</a>
</li>
<li>
<a
Expand Down
14 changes: 0 additions & 14 deletions assets/tests/components/nav/leftNav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import React from "react"
import { BrowserRouter } from "react-router-dom"
import LeftNav from "../../../src/components/nav/leftNav"
import { StateDispatchProvider } from "../../../src/contexts/stateDispatchContext"
import { displayHelp } from "../../../src/helpers/appCue"
import { openDrift } from "../../../src/helpers/drift"
import { tagManagerEvent } from "../../../src/helpers/googleTagManager"
import { initialState, togglePickerContainer } from "../../../src/state"
Expand Down Expand Up @@ -309,19 +308,6 @@ describe("LeftNav", () => {
expect(openDrift).toHaveBeenCalled()
})

test("clicking About Skate button displays help", async () => {
firestack marked this conversation as resolved.
Show resolved Hide resolved
const user = userEvent.setup()
const result = render(
<BrowserRouter>
<LeftNav defaultToCollapsed={false} dispatcherFlag={false} />
</BrowserRouter>
)

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()
Expand Down
18 changes: 1 addition & 17 deletions assets/tests/components/nav/navMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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(
<BrowserRouter>
<NavMenu toggleMobileMenu={toggleMobileMenu} mobileMenuIsOpen={false} />
</BrowserRouter>
)

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()

Expand All @@ -222,7 +206,7 @@ describe("NavMenu", () => {
</BrowserRouter>
)

await user.click(result.getByRole("button", { name: "About Skate" }))
await user.click(result.getByRole("link", { name: "About Skate" }))
firestack marked this conversation as resolved.
Show resolved Hide resolved

expect(toggleMobileMenu).toHaveBeenCalled()
})
Expand Down
Loading