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,8 +1,8 @@
// jscs:disable validateQuoteMarks
describe("archive service", function () {
'use strict';
var archive, mockBackend, mockGlobals, utils,
response;
var archive, mockBackend, mockGlobals, utils;
beforeEach(function () {

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Main controller", function () {
'use strict';
@ -176,10 +177,10 @@ describe("Main controller", 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();

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("model service", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Notifications service - ", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Page service", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("utils service", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("jplayer directive", function () {
'use strict';
@ -68,7 +69,7 @@ describe("jplayer directive", function() {
it("it sets jPlayer's media, stores the song for future scrobbling and sets the page title with the song", function () {
scope.$apply();
expect($.fn.jPlayer).toHaveBeenCalledWith('setMedia', {'mp3': 'https://gantry.com/antemarital/vigorless?a=oropharyngeal&b=killcrop#eviscerate'});
expect($.fn.jPlayer).toHaveBeenCalledWith('setMedia', { mp3: 'https://gantry.com/antemarital/vigorless?a=oropharyngeal&b=killcrop#eviscerate' });
expect(scope.currentSong).toEqual(playingSong);
expect(Page.setTitleSong).toHaveBeenCalledWith(playingSong);
});
@ -128,13 +129,13 @@ describe("jplayer directive", function() {
it("if the song's suffix is 'm4a', it sets jPlayer up with this format", function () {
playingSong.suffix = 'm4a';
scope.$apply();
expect($.fn.jPlayer).toHaveBeenCalledWith('setMedia', {'m4a': 'https://gantry.com/antemarital/vigorless?a=oropharyngeal&b=killcrop#eviscerate'});
expect($.fn.jPlayer).toHaveBeenCalledWith('setMedia', { m4a: 'https://gantry.com/antemarital/vigorless?a=oropharyngeal&b=killcrop#eviscerate' });
});
it("if the song's suffix is 'oga', it sets jPlayer up with this format", function () {
playingSong.suffix = 'oga';
scope.$apply();
expect($.fn.jPlayer).toHaveBeenCalledWith('setMedia', {'oga': 'https://gantry.com/antemarital/vigorless?a=oropharyngeal&b=killcrop#eviscerate'});
expect($.fn.jPlayer).toHaveBeenCalledWith('setMedia', { oga: 'https://gantry.com/antemarital/vigorless?a=oropharyngeal&b=killcrop#eviscerate' });
});
});

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Player service -", function () {
'use strict';
@ -166,7 +167,14 @@ describe("Player service -", function() {
var secondNewSong = { id: 6338, name: 'Preconquest', artist: 'France Wisley', album: 'Unmix' };
var thirdNewSong = { id: 3696, name: 'Cetene', artist: 'Hilario Masley', album: 'Gonapophysal' };
player.addSongs([newSong, secondNewSong, thirdNewSong]);
expect(player.queue).toEqual([firstSong, secondSong, thirdSong, newSong, secondNewSong, thirdNewSong]);
expect(player.queue).toEqual([
firstSong,
secondSong,
thirdSong,
newSong,
secondNewSong,
thirdNewSong
]);
});
it("when I remove the second song, the playing queue is now only the first and third song", function () {

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Player controller", function () {
'use strict';
@ -11,7 +12,7 @@ describe("Player controller", function() {
}
};
module('jamstash.player.controller');
module("jamstash.player.controller");
inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
@ -24,7 +25,7 @@ describe("Player controller", function() {
"togglePause"
]);
$controller('PlayerController', {
$controller("PlayerController", {
$scope: scope,
player: player,
globals: mockGlobals

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("repeat directive", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Queue controller", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Settings service", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Settings controller", function () {
'use strict';
@ -17,7 +18,13 @@ describe("Settings controller", function() {
};
// Mock all the services
utils = jasmine.createSpyObj("utils", ["HexEncode"]);
persistence = jasmine.createSpyObj("persistence", ["saveQueue", "deleteQueue", "deleteTrackPosition", "saveSettings", "deleteSettings"]);
persistence = jasmine.createSpyObj("persistence", [
"saveQueue",
"deleteQueue",
"deleteTrackPosition",
"saveSettings",
"deleteSettings"
]);
json = jasmine.createSpyObj("json", ["getChangeLog"]);
notifications = jasmine.createSpyObj("notifications", ["requestPermissionIfRequired", "isSupported", "updateMessage"]);

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("breadcrumbs directive", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks
describe("Breadcrumbs service -", function () {
'use strict';

View file

@ -1,3 +1,4 @@
// jscs:disable validateQuoteMarks, disallowOperatorBeforeLineBreak
describe("Subsonic service -", function () {
'use strict';
@ -250,7 +251,7 @@ describe("Subsonic service -", function() {
{ id: 695 },
{ id: 227 },
{ id: 422 },
{ id: 171 },
{ id: 171 }
]);
});
@ -259,12 +260,14 @@ describe("Subsonic service -", function() {
deferred.resolve({
directories: [],
songs: [
{ id: 33 }, { id: 595 }
{ id: 33 },
{ id: 595 }
]
});
expect(promise).toBeResolvedWith([
{ id: 33 }, { id: 595 }
{ id: 33 },
{ id: 595 }
]);
});
@ -299,7 +302,7 @@ describe("Subsonic service -", function() {
expect(promise).toBeResolvedWith([
{ id: 124 },
{ id: 731 },
{ id: 319 },
{ id: 319 }
]);
});
@ -414,7 +417,11 @@ describe("Subsonic service -", function() {
describe("Given that the global setting AutoPlaylist Size was 3", function () {
it("and given that there were more than 3 starred songs in my library, when I get random starred songs, then a promise will be resolved with an array of 3 starred songs", function () {
var library = [
{id: 11841},{id: 12061},{id: 17322},{id: 1547},{id: 14785}
{ id: 11841 },
{ id: 12061 },
{ id: 17322 },
{ id: 1547 },
{ id: 14785 }
];
response["subsonic-response"].starred = { song: library };
mockBackend.expectJSONP(url).respond(JSON.stringify(response));
@ -475,7 +482,11 @@ describe("Subsonic service -", function() {
describe("Given that the global setting AutoPlaylist Size was 3", function () {
it("and given that there were more than 3 songs in my library, when I get random songs, then a promise will be resolved with an array of 3 songs", function () {
var library = [
{id: 1143},{id: 5864},{id: 7407},{id: 6471},{id: 59}
{ id: 1143 },
{ id: 5864 },
{ id: 7407 },
{ id: 6471 },
{ id: 59 }
];
response["subsonic-response"].randomSongs = { song: library };
mockBackend.expectJSONP(url).respond(JSON.stringify(response));
@ -529,7 +540,9 @@ describe("Subsonic service -", function() {
url = 'http://demo.subsonic.com/rest/getRandomSongs.view?' +
'c=Jamstash&callback=JSON_CALLBACK&f=jsonp' + '&genre=Rock' + '&p=enc:cGFzc3dvcmQ%3D' + '&size=3' + '&u=Hyzual&v=1.10.2';
var library = [
{id: 9408},{id: 9470},{id: 6932}
{ id: 9408 },
{ id: 9470 },
{ id: 6932 }
];
response["subsonic-response"].randomSongs = { song: library };
mockBackend.expectJSONP(url).respond(JSON.stringify(response));
@ -544,7 +557,9 @@ describe("Subsonic service -", function() {
url = 'http://demo.subsonic.com/rest/getRandomSongs.view?' +
'c=Jamstash&callback=JSON_CALLBACK&f=jsonp' + '&musicFolderId=2' + '&p=enc:cGFzc3dvcmQ%3D' + '&size=3' + '&u=Hyzual&v=1.10.2';
var library = [
{id: 9232},{id: 3720},{id: 8139}
{ id: 9232 },
{ id: 3720 },
{ id: 8139 }
];
response["subsonic-response"].randomSongs = { song: library };
mockBackend.expectJSONP(url).respond(JSON.stringify(response));