Download frontend/src/components/video-source-icon.test.tsx from new-arc/vector: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/new-arc/vector/resolve/main/frontend/src/components/video-source-icon.test.tsx
- Command line
-
hf download hf://spaces/new-arc/vector/frontend/src/components/video-source-icon.test.tsx
-
curl -L -o video-source-icon.test.tsx https://huggingface.co/spaces/new-arc/vector/resolve/main/frontend/src/components/video-source-icon.test.tsx
1.07 kB
| import { render, screen } from "@testing-library/react"; | |
| import { VideoSourceIcon, videoSourceKind } from "./video-source-icon"; | |
| it("maps stored source types to their source", () => { | |
| expect(videoSourceKind("youtube")).toBe("youtube"); | |
| expect(videoSourceKind("twitch")).toBe("twitch"); | |
| expect(videoSourceKind("kick")).toBe("kick"); | |
| expect(videoSourceKind("video_url")).toBe("upload"); | |
| expect(videoSourceKind(undefined)).toBe("upload"); | |
| }); | |
| it.each([["twitch", "Twitch"], ["kick", "Kick"], ["youtube", "YouTube"]] as const)("labels the %s brand mark", (source, label) => { | |
| render(<VideoSourceIcon source={source} />); | |
| const icon = screen.getByRole("img", { name: label }); | |
| expect(icon).toHaveAttribute("data-source", source); | |
| expect(icon).toHaveAttribute("fill", "currentColor"); | |
| }); | |
| it("hides decorative icons from assistive tech", () => { | |
| const { container } = render(<VideoSourceIcon source="kick" aria-hidden />); | |
| expect(container.querySelector("svg")).toHaveAttribute("aria-hidden", "true"); | |
| expect(screen.queryByRole("img")).toBeNull(); | |
| }); | |