Skip to content

Commit

Permalink
Test for login
Browse files Browse the repository at this point in the history
Added a test to spy on the window.open
  • Loading branch information
eddiemoore committed Mar 31, 2015
1 parent ceb2c8c commit 05c39a9
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion test/spec/angular-spotify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,32 @@ describe('angular-spotify', function () {
});
});
});



describe('Spotify.login', function () {
it('should open the login window', function () {
spyOn(window, 'open');

Spotify.login();

var w = 400,
h = 500,
left = (screen.width / 2) - (w / 2),
top = (screen.height / 2) - (h / 2);

var params = {
client_id: null,
redirect_uri: null,
scope: '',
response_type: 'token'
};

expect(window.open).toHaveBeenCalled();
expect(window.open).toHaveBeenCalledWith('https://accounts.spotify.com/authorize?' + Spotify.toQueryString(params),
'Spotify',
'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=' + w + ',height=' + h + ',top=' + top + ',left=' + left);
});
});
});

});

0 comments on commit 05c39a9

Please sign in to comment.