mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-15 18:52:24 +00:00
Merge pull request #6320 from HabitRPG/sabrecat/fix-rehatch-modal
Fix modal display when rehatching pets
This commit is contained in:
commit
9366b22fef
2 changed files with 10 additions and 1 deletions
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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}});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue