v4: the header has two playlists links, each to its own page — it had three: the text button and the avatar menu's "Playlists" both led to the user's own playlists, and the menu's "All playlists" to /playlists. The text button now leads to /playlists, every public playlist, and shows to guests too, the page being open to them. The menu keeps one entry, "My playlists", to the user's own. Below 1150px, where the text button is hidden, the header no longer links to /playlists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,9 +13,13 @@ import { makeSession } from "../../fixtures.ts";
|
||||
import { currentPath, renderWithContexts } from "../../render.tsx";
|
||||
|
||||
describe("AppHeader", () => {
|
||||
test("guests get a login button", async () => {
|
||||
test("guests get the playlists link and a login button", async () => {
|
||||
const user = userEvent.setup();
|
||||
renderWithContexts(<AppHeader />);
|
||||
expect(screen.getByRole("link", { name: "Playlists" })).toHaveAttribute(
|
||||
"href",
|
||||
"/playlists",
|
||||
);
|
||||
await user.click(screen.getByRole("button", { name: "Log in" }));
|
||||
expect(currentPath()).toBe("/login");
|
||||
});
|
||||
@@ -26,7 +30,7 @@ describe("AppHeader", () => {
|
||||
});
|
||||
expect(screen.getByRole("link", { name: "Playlists" })).toHaveAttribute(
|
||||
"href",
|
||||
"/@ann/playlists",
|
||||
"/playlists",
|
||||
);
|
||||
expect(screen.getByRole("button", { name: "User menu" }))
|
||||
.toBeInTheDocument();
|
||||
|
||||
@@ -22,10 +22,13 @@ describe("UserMenu", () => {
|
||||
"href",
|
||||
"/@ann",
|
||||
);
|
||||
expect(screen.getByRole("menuitem", { name: "Playlists" })).toHaveAttribute(
|
||||
"href",
|
||||
"/@ann/playlists",
|
||||
);
|
||||
// One playlists link, the user's own: the header's leads to everyone's.
|
||||
expect(screen.getAllByRole("menuitem", { name: /playlists/i }))
|
||||
.toHaveLength(
|
||||
1,
|
||||
);
|
||||
expect(screen.getByRole("menuitem", { name: "My playlists" }))
|
||||
.toHaveAttribute("href", "/@ann/playlists");
|
||||
expect(screen.getByRole("menuitem", { name: "Community" })).toHaveAttribute(
|
||||
"href",
|
||||
"/community",
|
||||
|
||||
Reference in New Issue
Block a user