Merge pull request #6320 from HabitRPG/sabrecat/fix-rehatch-modal

Fix modal display when rehatching pets
This commit is contained in:
Sabe Jones 2015-12-01 14:16:21 -06:00
commit 9366b22fef
2 changed files with 10 additions and 1 deletions

View file

@ -79,6 +79,15 @@ describe('Inventory Controller', function() {
expect(rootScope.openModal).to.have.been.calledWith('hatchPet');
});
it('shows modal even if user has raised that pet to a mount', function(){
user.items.pets['Cactus-Base'] = -1;
scope.chooseEgg('Cactus');
scope.choosePotion('Base');
expect(rootScope.openModal).to.have.been.calledOnce;
expect(rootScope.openModal).to.have.been.calledWith('hatchPet');
});
it('does not show modal if user tries to hatch a pet they own', function(){
scope.chooseEgg('Cactus');
scope.choosePotion('Base');

View file

@ -115,7 +115,7 @@ habitrpg.controller("InventoryCtrl",
var potName = Content.hatchingPotions[potion.key].text();
if (!$window.confirm(window.env.t('hatchAPot', {potion: potName, egg: eggName}))) return;
var userHasPet = user.items.pets[egg.key + '-' + potion.key];
var userHasPet = user.items.pets[egg.key + '-' + potion.key] > 0;
user.ops.hatch({params:{egg:egg.key, hatchingPotion:potion.key}});