import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { InputDeviceProvider } from "../../utils/hooks/use-input-device"; import { Text } from "../text"; import { Tabs } from "./index"; const mockTabs = [ { index: "items", tabName: "Items", content: This is the Items tab, }, { index: "collections", tabName: "Collections", content: This is the Collections tab, }, { index: "projects", tabName: "Projects", content: This is the Projects tab, }, { index: "users", tabName: "Users", content: This is the Users tab, }, ]; describe("Tabs", () => { it("renders", () => { render( ); expect(screen.getByText("This is the Items tab")).toBeInTheDocument(); }); it("switches tabs on trigger click", async () => { const user = userEvent.setup(); render( ); const CollectionsTrigger = screen.getByText("Collections"); await user.click(CollectionsTrigger); expect(screen.getByText("This is the Collections tab")).toBeInTheDocument(); }); it("switches tabs on keyboard", async () => { const user = userEvent.setup(); render( ); await user.keyboard("{tab}{arrowright}"); expect(screen.getByText("This is the Collections tab")).toBeInTheDocument(); }); });