mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
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:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user