diff --git a/web/src/components/core/Sidebar.test.jsx b/web/src/components/core/Sidebar.test.jsx index 00d1e8b64a..ed8d6f7505 100644 --- a/web/src/components/core/Sidebar.test.jsx +++ b/web/src/components/core/Sidebar.test.jsx @@ -22,17 +22,9 @@ import React from "react"; import { screen, within } from "@testing-library/react"; import { plainRender, mockComponent, mockLayout } from "~/test-utils"; -import { PageOptions, Sidebar } from "~/components/core"; +import { Sidebar } from "~/components/core"; jest.mock("~/components/layout/Layout", () => mockLayout()); -jest.mock("~/components/core/PageOptions", () => mockComponent( - <> - Goes somewhere - Keep it open! - - - -)); it("renders the sidebar initially hidden", async () => { plainRender(); @@ -41,7 +33,7 @@ it("renders the sidebar initially hidden", async () => { }); it("renders a link for displaying the sidebar", async () => { - const { user } = plainRender(); + const { user } = plainRender(); const link = await screen.findByLabelText(/Show/i); const nav = await screen.findByRole("navigation", { name: /options/i }); @@ -52,7 +44,7 @@ it("renders a link for displaying the sidebar", async () => { }); it("renders a link for hiding the sidebar", async () => { - const { user } = plainRender(); + const { user } = plainRender(); const openLink = await screen.findByLabelText(/Show/i); const closeLink = await screen.findByLabelText(/Hide/i); @@ -66,7 +58,7 @@ it("renders a link for hiding the sidebar", async () => { }); it("moves the focus to the close action after opening it", async () => { - const { user } = plainRender(); + const { user } = plainRender(); const openLink = await screen.findByLabelText(/Show/i); const closeLink = await screen.findByLabelText(/Hide/i); @@ -78,7 +70,15 @@ it("moves the focus to the close action after opening it", async () => { describe("onClick bubbling", () => { it("hides the sidebar only if the user clicked on a link or button w/o keepSidebarOpen attribute", async () => { - const { user } = plainRender(); + const { user } = plainRender( + + Goes somewhere + Keep it open! + + + + ); + const openLink = screen.getByLabelText(/Show/i); await user.click(openLink); const nav = screen.getByRole("navigation", { name: /options/i }); diff --git a/web/src/components/layout/Layout.jsx b/web/src/components/layout/Layout.jsx index e5dbde40b0..0ef2e20278 100644 --- a/web/src/components/layout/Layout.jsx +++ b/web/src/components/layout/Layout.jsx @@ -27,7 +27,6 @@ import { ChangeProductLink } from "~/components/software"; import { About, Disclosure, LogsButton, Sidebar, ShowLogButton, ShowTerminalButton } from "~/components/core"; const PageTitle = createTeleporter(); -const PageOptions = createTeleporter(); const PageActions = createTeleporter(); const HeaderActions = createTeleporter(); const HeaderIcon = createTeleporter(); @@ -86,8 +85,6 @@ function Layout({ children }) { <> - - @@ -187,16 +184,6 @@ const MainActions = FooterActions.Source; */ const AdditionalInfo = FooterInfoArea.Source; -/** - * Component for setting the slot to place related options, usually in the Sidebar - */ -const PageOptionsSlot = PageOptions.Target; - -/** - * Component for teleport page related options to the PageOptions slot - */ -const PageOptionsContent = PageOptions.Source; - export { Layout as default, Title, @@ -205,6 +192,4 @@ export { ContextualActions, MainActions, AdditionalInfo, - PageOptionsSlot, - PageOptionsContent, }; diff --git a/web/src/test-utils.js b/web/src/test-utils.js index ba7c7f47aa..c1bb77de9c 100644 --- a/web/src/test-utils.js +++ b/web/src/test-utils.js @@ -148,7 +148,6 @@ const mockLayout = () => ({ ContextualActions: ({ children }) => children, MainActions: ({ children }) => children, AdditionalInfo: ({ children }) => children, - PageOptionsContent: ({ children }) => children, }); export {