mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
Merge branch 'sabrecat/quests-page' into develop
This commit is contained in:
commit
c15f2b1f80
3 changed files with 7 additions and 8 deletions
|
|
@ -97,7 +97,7 @@ describe('Quests Service', function() {
|
|||
expect(rootScope.openModal).to.have.been.notCalled;
|
||||
});
|
||||
|
||||
it('opens purchase modal if all prerequisites are met', function() {
|
||||
it('opens purchase modal if Gem quest prerequisites are met', function() {
|
||||
user.stats.lvl = 100;
|
||||
user.achievements.quests.atom1 = 2;
|
||||
|
||||
|
|
@ -108,11 +108,12 @@ describe('Quests Service', function() {
|
|||
expect(rootScope.openModal).to.have.been.calledWith('buyQuest');
|
||||
});
|
||||
|
||||
it('calls user ops buyQuest if quest is Gold-purchasable', function() {
|
||||
it('opens purchase modal if quest is Gold-purchasable', function() {
|
||||
questsService.buyQuest('dilatoryDistress1');
|
||||
|
||||
expect(user.ops.buyQuest).to.have.been.calledOnce;
|
||||
expect(rootScope.openModal).to.have.been.notCalled;
|
||||
expect(scope.selectedQuest).to.eql(content.quests.dilatoryDistress1);
|
||||
expect(rootScope.openModal).to.have.been.calledOnce;
|
||||
expect(rootScope.openModal).to.have.been.calledWith('buyQuest');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,9 +38,6 @@
|
|||
if (item.lvl && item.lvl > user.stats.lvl) {
|
||||
return alert(window.env.t('mustLvlQuest', {level: item.lvl}));
|
||||
}
|
||||
if (item.category === 'gold') {
|
||||
return User.user.ops.buyQuest({params:{key:item.key}});
|
||||
}
|
||||
$rootScope.selectedQuest = item;
|
||||
$rootScope.openModal('buyQuest', {controller:'InventoryCtrl'});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,8 @@ script(type='text/ng-template', id='modals/buyQuest.html')
|
|||
quest-rewards(key='{{::selectedQuest.key}}', header=env.t('rewards'))
|
||||
.modal-footer
|
||||
button.btn.btn-default(ng-click='closeQuest(); $close()')=env.t('neverMind')
|
||||
button.btn.btn-primary(ng-click='purchase("quests", quest); closeQuest(); $close()')=env.t('buyQuest')
|
||||
button.btn.btn-primary(ng-if='::selectedQuest.category !== "gold"', ng-click='purchase("quests", quest); closeQuest(); $close()')=env.t('buyQuest') + ': {{::selectedQuest.value}} ' + env.t('gems')
|
||||
button.btn.btn-primary(ng-if='::selectedQuest.category === "gold"', ng-click='user.ops.buyQuest({params:{key:selectedQuest.key}}); closeQuest(); $close()')=env.t('buyQuest') + ': {{::selectedQuest.goldValue}} ' + env.t('gold')
|
||||
|
||||
script(type='text/ng-template', id='modals/questInvitation.html')
|
||||
.modal-header
|
||||
|
|
|
|||
Loading…
Reference in a new issue