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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user