fix(design): claim audit part 1 — a closing key no longer re-presses its trigger, the Switch box and name, named z-levels (E28)
- In-place editors (Playlists heading + rail rename, Plex collection + playlist rename, PriorityStepper, Scheduler interval): a real Enter closed the editor, returned the focus to the trigger, and the same keystroke's activation pressed that trigger again - re-opening the editor, or in the rail selecting the renamed playlist. useReturnFocus.arm(e) now cancels the key's default (type-enforced); the rail and Scheduler editors do the same. The earlier tests dispatched a synthetic keydown, which has no default. - Plex playlist rename: an unchanged or empty title closes with no write, as the collection rename does. - Switch: a 36x24 box around the track (the 24 floor), 44 on a coarse pointer; `label` is required, and the Plex two-way-sync switch had no name. - z-index: numeric z-10/z-20 and a literal 40 moved onto the named layer scale; a lint rule + contract. - The /watch file card's Download is the filled primary: the page's one action. - Stale comments: the 1024x768 floor, the retired glass tuner.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
// (E9 review). The runtime sums the WHOLE list, an unknown duration counts as nothing, and a list
|
||||
// nothing sums for says no runtime at all.
|
||||
import { describe, it, expect, vi, beforeAll, afterEach } from "vitest";
|
||||
import { render, cleanup, screen } from "@testing-library/react";
|
||||
import { render, cleanup, screen, fireEvent } from "@testing-library/react";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
vi.mock("react-i18next", async (importOriginal) => ({
|
||||
@@ -71,3 +71,21 @@ describe("PlexPlaylistView · the header's meta line", () => {
|
||||
expect(await meta([movie("1")])).toBe("plex.browse.items");
|
||||
});
|
||||
});
|
||||
|
||||
// E28 audit: Enter on an unchanged (or emptied) title wrote the same name back to Plex, and an empty
|
||||
// one armed the focus hand-back while leaving the field open. Now both close with no write, as the
|
||||
// collection rename does.
|
||||
describe("PlexPlaylistView · rename", () => {
|
||||
it("closes without a write when the title is unchanged or empty", async () => {
|
||||
const write = vi.spyOn(api, "plexRenamePlaylist").mockResolvedValue({} as never);
|
||||
await meta([movie("1", 5400)]);
|
||||
for (const value of [null, " "]) {
|
||||
fireEvent.click(screen.getByRole("button", { name: "plex.playlist.rename" }));
|
||||
const field = screen.getByRole("textbox", { name: "plex.playlist.rename" });
|
||||
if (value !== null) fireEvent.change(field, { target: { value } });
|
||||
fireEvent.keyDown(field, { key: "Enter" });
|
||||
await screen.findByRole("heading", { name: "Films" });
|
||||
}
|
||||
expect(write).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user