fix(ui,i18n): E30 review round 2 — honest bio failure, a full show summary, one HU name per thing
- Person page: a bio ask that fails says so with a retry instead of reading as 'no biography'. - Show page: the summary is a ClampedText (5 lines + More), like the person and collection pages; one More/Less pair (plex.textMore/textLess) for all three. - Channels: a re-slotted row is placed in the language the server orders by (the stored preference, else English), not the UI's guess. - A skipped run's body is only the reason (its title already says skipped). - HU: Behúzási kvótatartalék; Eseménynapló ürítve / az eseménynaplót; indok; közvetlenül játszható / közvetlen közvetítés in the Plex hints. - Tests: ClampedText re-measures on a resize, the show summary clamp, serverOrderLang.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
// and the api is mocked so the query resolves synchronously in the test.
|
||||
import { setLanguage } from "../i18n";
|
||||
import { describe, it, expect, afterEach, beforeAll, vi } from "vitest";
|
||||
import { act, render, screen, fireEvent, cleanup } from "@testing-library/react";
|
||||
import { act, render, screen, fireEvent, cleanup, within } from "@testing-library/react";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
beforeAll(() => {
|
||||
@@ -251,7 +251,7 @@ describe("PlexPersonView — a bio on its way (E30 S6)", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("stops asking when the page's own request fails", async () => {
|
||||
it("stops asking when the page's own request fails, and says so with a retry", async () => {
|
||||
vi.useFakeTimers({ shouldAdvanceTime: true });
|
||||
try {
|
||||
plexPerson.mockReset();
|
||||
@@ -265,6 +265,12 @@ describe("PlexPersonView — a bio on its way (E30 S6)", () => {
|
||||
await act(() => vi.advanceTimersByTimeAsync(10_000));
|
||||
expect(plexPerson).toHaveBeenCalledTimes(2); // not every 1.5 s for as long as it fails
|
||||
expect(screen.queryByRole("status")).toBeNull();
|
||||
// Not a blank that reads as "no biography": the failure is said, and a retry asks again.
|
||||
const alert = screen.getByRole("alert");
|
||||
expect(alert.textContent).toContain("plex.person.bioFailed");
|
||||
plexPerson.mockResolvedValue(person({ biography: "Landed bio." }));
|
||||
fireEvent.click(within(alert).getByRole("button"));
|
||||
await screen.findByText("Landed bio.");
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
@@ -277,8 +283,8 @@ describe("PlexPersonView — a bio on its way (E30 S6)", () => {
|
||||
plexPerson.mockReset();
|
||||
plexPerson.mockResolvedValue(person({ biography: "A long life.\n\nMany films." }));
|
||||
wrap(view);
|
||||
fireEvent.click(await screen.findByText("plex.person.more"));
|
||||
expect(screen.getByText("plex.person.less").getAttribute("aria-expanded")).toBe("true");
|
||||
fireEvent.click(await screen.findByText("plex.textMore"));
|
||||
expect(screen.getByText("plex.textLess").getAttribute("aria-expanded")).toBe("true");
|
||||
} finally {
|
||||
tall.mockRestore();
|
||||
box.mockRestore();
|
||||
@@ -287,7 +293,7 @@ describe("PlexPersonView — a bio on its way (E30 S6)", () => {
|
||||
plexPerson.mockResolvedValue(person({ biography: "Short." }));
|
||||
wrap(view);
|
||||
await screen.findByText("Short.");
|
||||
expect(screen.queryByText("plex.person.more")).toBeNull(); // jsdom: nothing is cut
|
||||
expect(screen.queryByText("plex.textMore")).toBeNull(); // jsdom: nothing is cut
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user