Minor code style adjustments to comply with our jscsrc.

This commit is contained in:
Hyzual 2015-07-05 19:50:36 +02:00
parent 66478bf67e
commit 58829facd6
16 changed files with 547 additions and 505 deletions

View file

@ -1,9 +1,10 @@
describe("Main controller", function() {
// jscs:disable validateQuoteMarks
describe("Main controller", function () {
'use strict';
var controllerParams, $controller, $q, scope, mockGlobals, player, utils, persistence, subsonic, notifications,
deferred;
beforeEach(function() {
beforeEach(function () {
mockGlobals = {
settings: {
SaveTrackPosition: false,
@ -13,7 +14,7 @@ describe("Main controller", function() {
}
};
module('JamStash', function($provide) {
module('JamStash', function ($provide) {
$provide.value('globals', mockGlobals);
});
@ -77,16 +78,16 @@ describe("Main controller", function() {
});
});
xdescribe("toggleSetting -", function() {
xdescribe("toggleSetting -", function () {
});
describe("", function () {
beforeEach(function() {
beforeEach(function () {
$controller('AppController', controllerParams);
});
it("given that the global setting 'ShowQueue' is true, when the playing queue's length changes and is not empty, it shows the queue", function() {
it("given that the global setting 'ShowQueue' is true, when the playing queue's length changes and is not empty, it shows the queue", function () {
mockGlobals.settings.ShowQueue = true;
player.queue = [{
id: 684
@ -98,8 +99,8 @@ describe("Main controller", function() {
expect(scope.showQueue).toHaveBeenCalled();
});
describe("When I toggle pause,", function() {
it("given that we're using the Jukebox mode, it sends a 'stop' command to the jukebox", function() {
describe("When I toggle pause,", function () {
it("given that we're using the Jukebox mode, it sends a 'stop' command to the jukebox", function () {
mockGlobals.settings.Jukebox = true;
spyOn(scope, "sendToJukebox");
@ -107,13 +108,13 @@ describe("Main controller", function() {
expect(scope.sendToJukebox).toHaveBeenCalledWith('stop');
});
it("it toggles pause using the player service", function() {
it("it toggles pause using the player service", function () {
scope.togglePause();
expect(player.togglePause).toHaveBeenCalled();
});
});
it("When I turn the volume up, it sets the player's volume up and saves it using the persistence service", function() {
it("When I turn the volume up, it sets the player's volume up and saves it using the persistence service", function () {
player.turnVolumeUp.and.returnValue(0.6);
scope.turnVolumeUp();
@ -121,7 +122,7 @@ describe("Main controller", function() {
expect(persistence.saveVolume).toHaveBeenCalledWith(0.6);
});
it("When I turn the volume down, it sets the player's volume down and saves it using the persistence service", function() {
it("When I turn the volume down, it sets the player's volume down and saves it using the persistence service", function () {
player.turnVolumeDown.and.returnValue(0.4);
scope.turnVolumeDown();
@ -129,57 +130,57 @@ describe("Main controller", function() {
expect(persistence.saveVolume).toHaveBeenCalledWith(0.4);
});
it("When I go to the next track, it calls next track on the player", function() {
it("When I go to the next track, it calls next track on the player", function () {
scope.nextTrack();
expect(player.nextTrack).toHaveBeenCalled();
});
it("When I go to the previous track, it calls previous track on the player", function() {
it("When I go to the previous track, it calls previous track on the player", function () {
scope.previousTrack();
expect(player.previousTrack).toHaveBeenCalled();
});
describe("Given that I am targeting an input,", function() {
describe("Given that I am targeting an input,", function () {
var event;
beforeEach(function() {
beforeEach(function () {
event = { target: { tagName: "INPUT" } };
});
it("when I use a shortcut to toggle pause, it doesn't do anything", function() {
it("when I use a shortcut to toggle pause, it doesn't do anything", function () {
scope.togglePause(event);
expect(player.togglePause).not.toHaveBeenCalled();
});
it("when I use a shortcut to turn the volume up, it doesn't do anything", function() {
it("when I use a shortcut to turn the volume up, it doesn't do anything", function () {
scope.turnVolumeUp(event);
expect(player.turnVolumeUp).not.toHaveBeenCalled();
expect(persistence.saveVolume).not.toHaveBeenCalled();
});
it("when I use a shortcut to turn the volume down, it doesn't do anything", function() {
it("when I use a shortcut to turn the volume down, it doesn't do anything", function () {
scope.turnVolumeDown(event);
expect(player.turnVolumeDown).not.toHaveBeenCalled();
expect(persistence.saveVolume).not.toHaveBeenCalled();
});
it("when I use a shortcut to go to the next track, it doesn't do anything", function() {
it("when I use a shortcut to go to the next track, it doesn't do anything", function () {
scope.nextTrack(event);
expect(player.nextTrack).not.toHaveBeenCalled();
});
it("when I use a shortcut to go to the previous track, it doesn't do anything", function() {
it("when I use a shortcut to go to the previous track, it doesn't do anything", function () {
scope.previousTrack(event);
expect(player.previousTrack).not.toHaveBeenCalled();
});
});
describe("loadSettings() -", function() {
it("Given user settings were saved using persistence, when I load the settings, the globals object will be completed with them, excluding the Url setting", function() {
describe("loadSettings() -", function () {
it("Given user settings were saved using persistence, when I load the settings, the globals object will be completed with them, excluding the Url setting", function () {
persistence.getSettings.and.returnValue({
"Url": "http://gmelinite.com/contrastive/hypercyanotic?a=overdrive&b=chirpling#postjugular",
"Username": "Hollingshead",
"AutoPlaylistSize": 25,
"AutoPlay": true
Url: "http://gmelinite.com/contrastive/hypercyanotic?a=overdrive&b=chirpling#postjugular",
Username: "Hollingshead",
AutoPlaylistSize: 25,
AutoPlay: true
});
scope.loadSettings();
@ -191,12 +192,12 @@ describe("Main controller", function() {
});
describe("toggleStar() -", function() {
beforeEach(function() {
describe("toggleStar() -", function () {
beforeEach(function () {
subsonic.toggleStar.and.returnValue(deferred.promise);
});
it("Given an artist that was not starred, when I toggle its star, then subsonic service will be called, the artist will be starred and a notification will be displayed", function() {
it("Given an artist that was not starred, when I toggle its star, then subsonic service will be called, the artist will be starred and a notification will be displayed", function () {
var artist = { id: 4218, starred: false };
scope.toggleStar(artist);
deferred.resolve(true);
@ -207,7 +208,7 @@ describe("Main controller", function() {
expect(notifications.updateMessage).toHaveBeenCalledWith('Favorite Updated!', true);
});
it("Given a song that was starred, when I toggle its star, then subsonic service will be called, the song will be starred and a notification will be displayed", function() {
it("Given a song that was starred, when I toggle its star, then subsonic service will be called, the song will be starred and a notification will be displayed", function () {
var song = { id: 784, starred: true };
scope.toggleStar(song);
deferred.resolve(false);
@ -220,8 +221,8 @@ describe("Main controller", function() {
});
});
describe("When starting up,", function() {
it("it loads the volume from the persistence service and sets the player service's volume with it", function() {
describe("When starting up,", function () {
it("it loads the volume from the persistence service and sets the player service's volume with it", function () {
persistence.getVolume.and.returnValue(0.551835);
$controller('AppController', controllerParams);