fix(design): a row's "…" closes its own menu when its row object is rebuilt (E28 S3e2)
The "…" told its own menu from another row's by payload identity. The Plex playlist page builds each row's menu target afresh on every render, so a second press on the same "…" reopened the menu instead of closing it. useContextMenu takes an optional `keyOf`, and the page keys its targets by the row key.
This commit is contained in:
@@ -131,6 +131,20 @@ describe("PlexPlaylistView · a row's menu", () => {
|
||||
expect(moreOf("Movie 1").getAttribute("aria-expanded")).toBe("true");
|
||||
});
|
||||
|
||||
it("closes on a second press of the same '…', though its row is rebuilt each render", async () => {
|
||||
mount([movie("1")]);
|
||||
await screen.findByText("Movie 1");
|
||||
await openMenu(() => fireEvent.click(moreOf("Movie 1")));
|
||||
act(() => {
|
||||
fireEvent.pointerDown(moreOf("Movie 1"));
|
||||
fireEvent.mouseDown(moreOf("Movie 1"));
|
||||
fireEvent.click(moreOf("Movie 1"), { detail: 1 });
|
||||
});
|
||||
await waitFor(() =>
|
||||
expect(screen.queryAllByRole("menuitem", { hidden: true })).toHaveLength(0),
|
||||
);
|
||||
});
|
||||
|
||||
it("removes a title with no confirm, and the toast's Undo puts it back at its index", async () => {
|
||||
mount([movie("1"), movie("2"), movie("3")]);
|
||||
await screen.findByText("Movie 2");
|
||||
|
||||
Reference in New Issue
Block a user