34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import "@testing-library/jest-dom";
|
|
import { fireEvent, render, screen } from "@testing-library/react";
|
|
import { MemoryRouter } from "react-router";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { HoverEffect } from "./HoverEffect";
|
|
|
|
describe("HoverEffect accessibility", () => {
|
|
it("names image preview and modal external-link controls by action", async () => {
|
|
render(
|
|
<MemoryRouter>
|
|
<HoverEffect
|
|
items={[
|
|
{
|
|
name: "Analytics",
|
|
description: "View reporting snapshots.",
|
|
img: "/analytics.png",
|
|
link: {
|
|
href: "/analytics",
|
|
},
|
|
subFeatures: [{ name: "Reports" }],
|
|
},
|
|
]}
|
|
/>
|
|
</MemoryRouter>
|
|
);
|
|
|
|
fireEvent.click(screen.getByRole("button", { name: "preview image for Analytics" }));
|
|
|
|
const externalLink = await screen.findByRole("link", { name: "open Analytics" });
|
|
expect(externalLink).toHaveAttribute("href", "/analytics");
|
|
});
|
|
});
|