forked from HabitRPG/habitica
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PRs 2017/04/07 - 2017/04/14 (HabitRPG#8691)
* Issue 8432: Pre-test for initial fix * Add failing test, seeking help/advice * Fixes achievements injection. Now trying with Guide * Fixes tests * Remoed logging * Mock ENV function * Removes test focus * Remove Beat Master unlock for Rebirth * Special message when complete all check-in prizes * Updated comment * fix(test): unpend party cap test * remove wrong subscriptions from gift modal * edit the new issue template to emphasise that the Report a Bug guild should be used first (HabitRPG#8659) * fix(translation): resolve merge conflict * fix(news): merge conflict * Added email invite limit (HabitRPG#8664) * Added email invite limit * change error message for sending too many invitations to instruct them to email us * fix test error message to use variable in locales string * add comment to warn about keeping INVITES_LIMIT low If INVITES_LIMIT is allowed to be greater than MAX_EMAIL_INVITES_BY_USER then the inviter can send more than MAX_EMAIL_INVITES_BY_USER invitations at once. * Fix for automatic allocation not persisting HabitRPG#8641 (HabitRPG#8661) * Fixed text of check-in prize when it is a set of backgrounds (HabitRPG#8599) * Fixed text of check-in prize when it is a set of backgrounds * Use existing i18n string for BGs name * Added user.preferences.language as second parameter * fix Shiny Seeds info about achievement (not given to caster) (HabitRPG#8679) Ref: https://habitica.slack.com/archives/C02RK7DKF/p1492032261365388 * Release mergeback v3.86.0 (HabitRPG#8685) * 3.85.0 * New User Tasks for Mobile (HabitRPG#8682) * feat(mobile): different default tasks * fix(linting): missing space * fix(user): correct client type logic * test(integration): tasks by platform * fix(test): remove only * test(user): deeper checks on tasks * refactor(test): whitespace for readability * feat(subs): Jackalope Pets (HabitRPG#8684) * chore(sprites): compile * chore(i18n): update locales * 3.86.0
- Loading branch information
Showing
12 changed files
with
146 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
'use strict'; | ||
|
||
describe('User Controller', function() { | ||
var $rootScope, $window, User, shared, scope, ctrl, content; | ||
|
||
beforeEach(function() { | ||
module(function ($provide) { | ||
var user = specHelper.newUser(); | ||
User = {user: user} | ||
$provide.value('Guide', sandbox.stub()); | ||
$provide.value('User', User); | ||
$provide.value('Achievement', sandbox.stub()); | ||
$provide.value('Social', sandbox.stub()); | ||
$provide.value('Shared', { | ||
achievements: { | ||
getAchievementsForProfile: sandbox.stub() | ||
}, | ||
shops: { | ||
getBackgroundShopSets: sandbox.stub() | ||
} | ||
}); | ||
$provide.value('Content', { | ||
loginIncentives: sandbox.stub() | ||
}) | ||
}); | ||
|
||
inject(function($rootScope, $controller, User, Content) { | ||
scope = $rootScope.$new(); | ||
content = Content; | ||
$controller('RootCtrl', { $scope: scope, User: User}); | ||
ctrl = $controller('UserCtrl', { $scope: scope, User: User, $window: $window}); | ||
}); | ||
}); | ||
|
||
describe('getProgressDisplay', function() { | ||
|
||
beforeEach(() => { | ||
sandbox.stub(window.env, 't'); | ||
window.env.t.onFirstCall().returns('Progress until next'); | ||
}); | ||
|
||
it('should return initial progress', function() { | ||
scope.profile.loginIncentives = 0; | ||
content.loginIncentives = [{ | ||
nextRewardAt: 1, | ||
reward: true | ||
}]; | ||
var actual = scope.getProgressDisplay(); | ||
expect(actual.trim()).to.eql('Progress until next 0/1'); | ||
}); | ||
|
||
it('should return progress between next reward and current reward', function() { | ||
scope.profile.loginIncentives = 1; | ||
content.loginIncentives = [{ | ||
nextRewardAt: 1, | ||
reward: true | ||
}, { | ||
prevRewardAt: 0, | ||
nextRewardAt: 2, | ||
reward: true | ||
}, { | ||
prevRewardAt: 1, | ||
nextRewardAt: 3 | ||
}]; | ||
var actual = scope.getProgressDisplay(); | ||
expect(actual.trim()).to.eql('Progress until next 0/1'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
script(id='partials/options.profile.stats.html', type='text/ng-template') | ||
.container-fluid | ||
div(class='row') | ||
.border-right(ng-class='user.flags.classSelected && !user.preferences.disableClasses ? "col-md-4" : "col-md-6"') | ||
include ../../shared/profiles/stats_col1 | ||
div(ng-class='user.flags.classSelected && !user.preferences.disableClasses ? "col-md-4" : "col-md-6"') | ||
button.btn.btn-default(ng-if='user.preferences.disableClasses', ng-click='User.changeClass({})', popover-trigger='mouseenter', popover-placement='right', popover=env.t('enableClassPop'))= env.t('enableClass') | ||
hr(ng-if='user.preferences.disableClasses') | ||
include ../../shared/profiles/stats_col2 | ||
.col-md-4.border-left.allocate-stats(ng-if='user.flags.classSelected && !user.preferences.disableClasses') | ||
h3=env.t('characterBuild') | ||
h4 | ||
=env.t('class') + ': ' | ||
span {{ {warrior:env.t("warrior"), wizard:env.t("mage"), rogue:env.t("rogue"), healer:env.t("healer")}[user.stats.class] }} | ||
a.btn.btn-danger.btn-xs(ng-click='changeClass(null)')=env.t('changeClass') | ||
small.cost 3 <span class="Pet_Currency_Gem1x inline-gems"/> | ||
table.table.table-striped | ||
tr | ||
td | ||
p(ng-if='::user.stats.lvl >= 100')!=env.t('noMoreAllocate') | ||
p(ng-if='user.stats.points || user.stats.lvl < 100') | ||
strong.inline | ||
|{{user.stats.points}} | ||
strong.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('levelPopover'))=env.t('unallocated') | ||
td | ||
tr | ||
td(colspan=2) | ||
fieldset.auto-allocate | ||
.checkbox | ||
label | ||
input(type='checkbox', ng-model='user.preferences.automaticAllocation', ng-change='set({"preferences.automaticAllocation": user.preferences.automaticAllocation?true: false})', ng-click='set({"preferences.allocationMode":"taskbased"})') | ||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('autoAllocationPop'))=env.t('autoAllocation') | ||
form(ng-show='user.preferences.automaticAllocation',style='margin-left:1em') | ||
.radio | ||
label | ||
input(type='radio', name='allocationMode', value='flat', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "flat"})') | ||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('evenAllocationPop'))=env.t('evenAllocation') | ||
.radio | ||
label | ||
input(type='radio', name='allocationMode', value='classbased', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "classbased"})') | ||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('classAllocationPop'))=env.t('classAllocation') | ||
.radio | ||
label | ||
input(type='radio', name='allocationMode', value='taskbased', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "taskbased"})') | ||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('taskAllocationPop'))=env.t('taskAllocation') | ||
div(ng-show='user.preferences.automaticAllocation && !(user.preferences.allocationMode === "taskbased") && (user.stats.points > 0)') | ||
a.btn.btn-primary.btn-xs(ng-click='User.allocateNow({})', popover-trigger='mouseenter', popover-placement='right', popover=env.t('distributePointsPop')) | ||
span.glyphicon.glyphicon-download | ||
| | ||
=env.t('distributePoints') | ||
+statAllocation() | ||
script(id='partials/options.profile.stats.html', type='text/ng-template') | ||
.container-fluid | ||
div(class='row') | ||
.border-right(ng-class='user.flags.classSelected && !user.preferences.disableClasses ? "col-md-4" : "col-md-6"') | ||
include ../../shared/profiles/stats_col1 | ||
div(ng-class='user.flags.classSelected && !user.preferences.disableClasses ? "col-md-4" : "col-md-6"') | ||
button.btn.btn-default(ng-if='user.preferences.disableClasses', ng-click='User.changeClass({})', popover-trigger='mouseenter', popover-placement='right', popover=env.t('enableClassPop'))= env.t('enableClass') | ||
hr(ng-if='user.preferences.disableClasses') | ||
include ../../shared/profiles/stats_col2 | ||
.col-md-4.border-left.allocate-stats(ng-if='user.flags.classSelected && !user.preferences.disableClasses') | ||
h3=env.t('characterBuild') | ||
h4 | ||
=env.t('class') + ': ' | ||
span {{ {warrior:env.t("warrior"), wizard:env.t("mage"), rogue:env.t("rogue"), healer:env.t("healer")}[user.stats.class] }} | ||
a.btn.btn-danger.btn-xs(ng-click='changeClass(null)')=env.t('changeClass') | ||
small.cost 3 <span class="Pet_Currency_Gem1x inline-gems"/> | ||
table.table.table-striped | ||
tr | ||
td | ||
p(ng-if='::user.stats.lvl >= 100')!=env.t('noMoreAllocate') | ||
p(ng-if='user.stats.points || user.stats.lvl < 100') | ||
strong.inline | ||
|{{user.stats.points}} | ||
strong.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('levelPopover'))=env.t('unallocated') | ||
td | ||
tr | ||
td(colspan=2) | ||
fieldset.auto-allocate | ||
.checkbox | ||
label | ||
input(type='checkbox', ng-model='user.preferences.automaticAllocation', ng-change='set({"preferences.automaticAllocation": user.preferences.automaticAllocation, "preferences.allocationMode":"taskbased"})') | ||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('autoAllocationPop'))=env.t('autoAllocation') | ||
form(ng-show='user.preferences.automaticAllocation',style='margin-left:1em') | ||
.radio | ||
label | ||
input(type='radio', name='allocationMode', value='flat', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "flat"})') | ||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('evenAllocationPop'))=env.t('evenAllocation') | ||
.radio | ||
label | ||
input(type='radio', name='allocationMode', value='classbased', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "classbased"})') | ||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('classAllocationPop'))=env.t('classAllocation') | ||
.radio | ||
label | ||
input(type='radio', name='allocationMode', value='taskbased', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "taskbased"})') | ||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('taskAllocationPop'))=env.t('taskAllocation') | ||
div(ng-show='user.preferences.automaticAllocation && !(user.preferences.allocationMode === "taskbased") && (user.stats.points > 0)') | ||
a.btn.btn-primary.btn-xs(ng-click='User.allocateNow({})', popover-trigger='mouseenter', popover-placement='right', popover=env.t('distributePointsPop')) | ||
span.glyphicon.glyphicon-download | ||
| | ||
=env.t('distributePoints') | ||
+statAllocation() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters