test(fe): cover the palette's content, AltGr, the banner's name, share colours, playlist headers
- AppCommandPalette had no test: modules gated by the account, hidden channels left out, the playlist row selecting before it navigates, and the surprise riding setPage's `then`. - keymap: an Alt/AltGr-modified key (Ctrl+Alt on Windows, a constant on the HU layout) fires no bare-key or Mod row. - Banner: the dismiss button falls back to "Close" rather than going unnamed. - ShareDialog: a protected link's lit lock and Revoke's danger colour stay on the icon. - Both playlist headers are rendered now: the YouTube one needed the toolbar slot it portals into. Meta line sums known runtimes and treats an ABSENT duration as nothing (null never exercised the guard: `3000 + null` is 3000); a one-row list offers no view controls.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// @vitest-environment jsdom
|
||||
import { describe, it, expect, afterEach, vi } from "vitest";
|
||||
import { render, screen, cleanup } from "@testing-library/react";
|
||||
import { Info } from "lucide-react";
|
||||
|
||||
vi.mock("react-i18next", () => ({ useTranslation: () => ({ t: (k: string) => k }) }));
|
||||
|
||||
import Banner from "./Banner";
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
// The dismiss button is an icon, so its name is all a screen reader gets. A caller that forgets
|
||||
// `dismissTitle` must still ship a NAMED control — the generic "Close" — never an unnamed one.
|
||||
describe("Banner · the dismiss button's name", () => {
|
||||
it("falls back to the generic Close, and takes the caller's name when given", () => {
|
||||
render(
|
||||
<Banner tone="accent" icon={Info} onDismiss={() => {}}>
|
||||
News
|
||||
</Banner>,
|
||||
);
|
||||
expect(screen.getByRole("button", { name: "common.close" })).toBeTruthy();
|
||||
cleanup();
|
||||
|
||||
render(
|
||||
<Banner tone="accent" icon={Info} onDismiss={() => {}} dismissTitle="Hide the notes">
|
||||
News
|
||||
</Banner>,
|
||||
);
|
||||
expect(screen.getByRole("button", { name: "Hide the notes" })).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user