2015-04-10 02:57:06 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
2015-04-11 05:01:39 +00:00
|
|
|
describe('Hall of Heroes Controller', function() {
|
2015-04-10 02:57:06 +00:00
|
|
|
var scope, ctrl, user, $rootScope;
|
|
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
|
module(function($provide) {
|
|
|
|
|
$provide.value('User', {});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
inject(function($rootScope, $controller){
|
|
|
|
|
user = specHelper.newUser();
|
|
|
|
|
|
|
|
|
|
scope = $rootScope.$new();
|
|
|
|
|
|
|
|
|
|
// Load RootCtrl to ensure shared behaviors are loaded
|
|
|
|
|
$controller('RootCtrl', {$scope: scope, User: {user: user}});
|
|
|
|
|
|
|
|
|
|
ctrl = $controller('HallHeroesCtrl', {$scope: scope, User: {user: user}});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('populates contributor input with selected hero id', function(){
|
2015-06-20 19:48:38 +00:00
|
|
|
var loadHero = sandbox.spy(scope, "loadHero");
|
|
|
|
|
var scrollTo = sandbox.spy(window, "scrollTo");
|
2015-04-11 04:51:34 +00:00
|
|
|
|
2015-04-10 02:57:06 +00:00
|
|
|
scope.populateContributorInput(user._id);
|
|
|
|
|
expect(scope._heroID).to.eql(user._id);
|
2015-04-11 04:51:34 +00:00
|
|
|
expect(loadHero.callCount).to.eql(1);
|
|
|
|
|
expect(scrollTo.callCount).to.eql(1);
|
2015-04-10 02:57:06 +00:00
|
|
|
});
|
|
|
|
|
});
|