diff --git a/public/js/Tunes.js b/public/js/Tunes.js index 1935826..8d07787 100644 --- a/public/js/Tunes.js +++ b/public/js/Tunes.js @@ -72,6 +72,7 @@ reset: function() { player.pause(); + paused = false; current.album = 0; current.track = 0; }, @@ -126,4 +127,4 @@ return audio; }); -})(window); \ No newline at end of file +})(window); diff --git a/test-js/spec/TunesSpec.js b/test-js/spec/TunesSpec.js index 384895d..fb493ce 100644 --- a/test-js/spec/TunesSpec.js +++ b/test-js/spec/TunesSpec.js @@ -278,6 +278,21 @@ describe('player service', function() { player.playlist.remove(albumData[0]); // nothing happend, not in the playlist expect(player.playlist.length).toBe(0); }); + + it('should not continue playing a removed song after removing an album from the playlist', function() { + player.playlist.add(albumData[0]); + player.playlist.add(albumData[1]); + player.play(); + expect(player.playing).toBe(true); + expect(audioMock.src).toBe("/music/Album A Track A.mp3"); + + player.playlist.remove(albumData[0]); + expect(player.playing).toBe(false); + + player.play(); + expect(player.playing).toBe(true); + expect(audioMock.src).toBe("/music/Album B Track A.mp3"); + }); }); }); }); @@ -288,4 +303,4 @@ describe('audio service', function() { it('should create and return html5 audio element', inject(function(audio) { expect(audio.nodeName).toBe('AUDIO'); })); -}); \ No newline at end of file +});