fix(player): player bar context menu acts on the current song, not its album (#1117)

* fix(player): player bar context menu acts on the current song, not its album

Right-clicking the current track in the player bar built an album object
from the playing track and opened the album context menu, so "Add to
playlist" added the whole album instead of the song. It now opens a
song-scoped menu for the current track. Left-click on the title still
navigates to the album.

* docs(changelog): note player bar add-to-playlist fix (#1117)
This commit is contained in:
Psychotoxical
2026-06-17 17:07:47 +02:00
committed by GitHub
parent 116196f0d4
commit 44d373d7bb
3 changed files with 32 additions and 12 deletions
+19
View File
@@ -144,6 +144,25 @@ describe('PlayerBar — control wiring', () => {
});
});
describe('PlayerBar — current track context menu', () => {
it('right-clicking the track name opens a song-scoped menu for the current track (#1116)', () => {
const track = makeTrack({ id: 'cur', albumId: 'alb-1' });
usePlayerStore.setState({ currentTrack: track, isPlaying: true });
const spy = vi.spyOn(usePlayerStore.getState(), 'openContextMenu');
const { container } = renderWithProviders(<PlayerBar />);
const trackName = container.querySelector('.player-track-name');
expect(trackName).not.toBeNull();
fireEvent.contextMenu(trackName!);
expect(spy).toHaveBeenCalledTimes(1);
const [, , item, type, , , , , pin] = spy.mock.calls[0];
expect(item).toBe(track);
expect(type).toBe('song');
expect(pin).toBe(true);
});
});
describe('PlayerBar — empty state (no current track)', () => {
it('still renders the region landmark when no track is loaded', () => {
usePlayerStore.setState({ currentTrack: null, isPlaying: false });