v3: the dump page's "In collections" list only shows the owner's private badge — every card there said "public", which says nothing on a list of playlists holding the dump. PlaylistCard takes privateBadgeOnly, passed through PlaylistCardList, which hides the visibility badge except on a private playlist of the signed-in user's; the other lists of playlists keep both badges. 5 PlaylistCard tests pass (new: privateBadgeOnly), and tsc, eslint, doc:lint and deno fmt are clean.
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 53s
Build and Deploy Static Documentation Site / build-and-push (push) Successful in 22s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
khannurien
2026-09-30 21:19:06 +00:00
parent f3f07ed1e3
commit 5f0cf86fe6
4 changed files with 45 additions and 12 deletions

View File

@@ -67,6 +67,27 @@ describe("PlaylistCard", () => {
expect(again.container.querySelector(".unread-dot")).toBeNull();
});
test("privateBadgeOnly shows only the owner's private badge", () => {
const cases = [
{ isPublic: true, isOwner: true, shown: false },
{ isPublic: false, isOwner: false, shown: false },
{ isPublic: false, isOwner: true, shown: true },
];
for (const { isPublic, isOwner, shown } of cases) {
const { container, unmount } = renderWithContexts(
<ul>
<PlaylistCard
playlist={makePlaylist({ isPublic })}
isOwner={isOwner}
privateBadgeOnly
/>
</ul>,
);
expect(container.querySelector(".playlist-badge") !== null).toBe(shown);
unmount();
}
});
test("delete doesn't open the playlist", async () => {
const onDelete = vi.fn();
const user = userEvent.setup();