feat(plex): every card rail in the reader's language; an episode in a poster rail stands as its show (E30 S1b)
The grid served Hungarian titles, but every other card surface (Discover rails, the show page's episodes, search, collections, the person page, playlists, Home's resume rail, hero and comfort shelf) served English. The card serializers now take a required keyword-only lang (a forgotten call site fails instead of going English), and each of those reads takes ?lang=hu, with the language in its query key. A Hungarian search finds an episode by its Hungarian title too. An episode on a poster rail showed its 16:9 still cropped into a poster, titled only with the episode name; it now shows the show's poster and name, with S·E · title under it (option A). Plex's generic season names (Season 1, Specials) are rebuilt from the number in the reader's language; a season with a name of its own keeps it. Home's comfort-shelf move wrote its optimistic order to the key without the language, which nothing read any more; it writes the query's own key.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
// expanded (lazily, on click) into its episodes in season→episode order; a show that expands to zero
|
||||
// episodes must NOT silently no-op but surface the `playEmpty` info notice. api.plexCollection /
|
||||
// api.plexShow are stubbed so the queries resolve synchronously; notify is spied to assert the notice.
|
||||
import { setLanguage } from "../i18n";
|
||||
import { describe, it, expect, vi, beforeAll, afterEach } from "vitest";
|
||||
import { render, screen, fireEvent, waitFor, cleanup } from "@testing-library/react";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
@@ -119,7 +120,7 @@ describe("PlexCollectionView — Play-all", () => {
|
||||
const onPlay = mount([card("show1", "show")]);
|
||||
fireEvent.click(await screen.findByText("plex.collection.playAll"));
|
||||
await waitFor(() => expect(onPlay).toHaveBeenCalledTimes(1));
|
||||
expect(spyShow).toHaveBeenCalledWith("show1");
|
||||
expect(spyShow).toHaveBeenCalledWith("show1", "en");
|
||||
expect(onPlay).toHaveBeenCalledWith("s1e1", ["s1e1", "s1e2", "s2e1"]);
|
||||
});
|
||||
|
||||
@@ -205,3 +206,19 @@ describe("PlexCollectionView — after the sort joined the query key", () => {
|
||||
expect(screen.queryByText("plex.collection.playAll")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("PlexCollectionView — the reader's language (E30)", () => {
|
||||
it("asks for the members, and a show it expands, in Hungarian", async () => {
|
||||
setLanguage("hu");
|
||||
try {
|
||||
const spyShow = vi.spyOn(api, "plexShow").mockResolvedValue(showDetail([["s1e1"]]));
|
||||
const onPlay = mount([card("show1", "show")]);
|
||||
fireEvent.click(await screen.findByText("plex.collection.playAll"));
|
||||
await waitFor(() => expect(onPlay).toHaveBeenCalledTimes(1));
|
||||
expect(vi.mocked(api.plexCollection).mock.calls[0]?.[2]).toBe("hu");
|
||||
expect(spyShow).toHaveBeenCalledWith("show1", "hu");
|
||||
} finally {
|
||||
setLanguage("en");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user