fix(plex): a matched episode and a collection member offer Details in their menu
Their titles open the item's page, a pointer-only door; the card menu is the keyboard's.
This commit is contained in:
@@ -21,6 +21,7 @@ vi.mock("./PlexPlayer", () => ({
|
||||
vi.mock("./plexViews", async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import("./plexViews")>()),
|
||||
PlexShowView: ({ showId }: { showId: string }) => <div>show page {showId}</div>,
|
||||
PlexInfoView: ({ id }: { id: string }) => <div>info page {id}</div>,
|
||||
}));
|
||||
|
||||
import PlexBrowse from "./PlexBrowse";
|
||||
@@ -53,12 +54,12 @@ const show: PlexCard = {
|
||||
resumable: true,
|
||||
};
|
||||
|
||||
function mount() {
|
||||
function mount(episodes: PlexCard[] = []) {
|
||||
vi.spyOn(api, "plexLibrary").mockResolvedValue({
|
||||
items: [show],
|
||||
total: 1,
|
||||
offset: 0,
|
||||
episodes: [],
|
||||
episodes,
|
||||
} as never);
|
||||
const next = vi.spyOn(api, "plexShowNext").mockResolvedValue({
|
||||
next: { id: "e7", type: "episode", title: "Ep 7", thumb: "" },
|
||||
@@ -93,6 +94,16 @@ describe("PlexBrowse — a show's card in the grid", () => {
|
||||
expect(next).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
// A matched episode's title opens its page, a pointer's door: its menu offers the same to the keyboard.
|
||||
it("opens a matched episode's page from its menu, as its title does", async () => {
|
||||
mount([{ id: "ep1", type: "episode", title: "Pilot", thumb: "", show_title: "Grimm" }]);
|
||||
const section = (await screen.findByText("plex.unified.episodes")).parentElement!;
|
||||
fireEvent.click(section.querySelector<HTMLButtonElement>("button[aria-haspopup]")!);
|
||||
const rows = await screen.findAllByRole("menuitem", { hidden: true });
|
||||
fireEvent.click(rows.find((r) => r.textContent === "plex.info.title")!);
|
||||
expect(await screen.findByText("info page ep1")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("opens the show's page from its ⓘ, asking nothing", async () => {
|
||||
const { next } = mount();
|
||||
fireEvent.click(await screen.findByRole("button", { name: "plex.openShow" }));
|
||||
|
||||
Reference in New Issue
Block a user