When shuffling the playing queue, the currently playing song will always stay at the first position.

So that we don't end up at the end of the queue after we shuffle it.

- The queue controller will also scroll the queue up to the first element so the user notices the playing song stayed first
This commit is contained in:
Hyzual 2015-03-30 22:31:57 +02:00
parent 9fbd7bcf8e
commit 86eaea4b0e
4 changed files with 37 additions and 6 deletions

View file

@ -36,10 +36,14 @@ describe("Queue controller", function() {
expect($.fancybox.close).toHaveBeenCalled();
});
it("When I shuffle the queue, it calls shuffleQueue in the player service", function() {
it("When I shuffle the queue, then the player's shuffleQueue will be called and the queue will be scrolled back to the first element", function() {
spyOn(player, "shuffleQueue");
spyOn($.fn, 'scrollTo');
scope.shuffleQueue();
expect(player.shuffleQueue).toHaveBeenCalled();
expect($.fn.scrollTo).toHaveBeenCalledWith('.header', jasmine.any(Number));
});
it("When I add one song to the queue, it calls addSong in the player service", function() {