diff --git a/test/spec/hallCtrlSpec.js b/test/spec/hallCtrlSpec.js index b795024887..dce34c838a 100644 --- a/test/spec/hallCtrlSpec.js +++ b/test/spec/hallCtrlSpec.js @@ -22,7 +22,15 @@ describe.only('Hall of Heroes Controller', function() { }); it('populates contributor input with selected hero id', function(){ + var loadHero = sinon.spy(scope, "loadHero"); + var scrollTo = sinon.spy(window, "scrollTo"); + scope.populateContributorInput(user._id); expect(scope._heroID).to.eql(user._id); + expect(loadHero.callCount).to.eql(1); + expect(scrollTo.callCount).to.eql(1); + + scope.loadHero.restore(); + window.scrollTo.restore(); }); }); diff --git a/website/public/js/controllers/hallCtrl.js b/website/public/js/controllers/hallCtrl.js index 97aaeec1e6..fe385a316c 100644 --- a/website/public/js/controllers/hallCtrl.js +++ b/website/public/js/controllers/hallCtrl.js @@ -20,6 +20,8 @@ habitrpg.controller("HallHeroesCtrl", ['$scope', '$rootScope', 'User', 'Notifica $scope.populateContributorInput = function(id) { $scope._heroID = id; + window.scrollTo(0,200); + $scope.loadHero(id); }; }]);