Starts rewriting the player service.
The API is simplified: we can play a song, restart the currently playing song, load a song (that'll be used only by local storage), play the next track or the previous track. As a result, I changed all the calls to playSong(false, song) which are now just play(song)
This commit is contained in:
parent
226a768987
commit
e51961c167
13 changed files with 145 additions and 446 deletions
|
@ -13,7 +13,7 @@ describe("Queue controller", function() {
|
|||
player = _player_;
|
||||
|
||||
// Mock the functions of the services
|
||||
spyOn(player, "playSong").and.stub();
|
||||
spyOn(player, "play").and.stub();
|
||||
|
||||
$controller('QueueController', {
|
||||
$rootScope: $rootScope,
|
||||
|
@ -23,11 +23,11 @@ describe("Queue controller", function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
it("When I call playSong, it calls playSong in the player service", function() {
|
||||
it("When I call playSong, it calls play in the player service", function() {
|
||||
var fakeSong = {"id": 3174};
|
||||
|
||||
scope.playSong(true, fakeSong);
|
||||
scope.playSong(fakeSong);
|
||||
|
||||
expect(player.playSong).toHaveBeenCalledWith(true, fakeSong);
|
||||
expect(player.play).toHaveBeenCalledWith(fakeSong);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue