mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-03 12:40:00 +00:00
scroll to top and load hero; add tests for new behavior.
This commit is contained in:
parent
24ef3aa012
commit
8642366f15
2 changed files with 10 additions and 0 deletions
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
}]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue