mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Added getter use
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
||||||
import NotificationsComponent from 'client/components/notifications.vue';
|
import NotificationsComponent from 'client/components/notifications.vue';
|
||||||
import Store from 'client/libs/store';
|
import Store from 'client/libs/store';
|
||||||
|
import { hasClass } from 'client/store/getters/members';
|
||||||
|
|
||||||
const localVue = createLocalVue();
|
const localVue = createLocalVue();
|
||||||
localVue.use(Store);
|
localVue.use(Store);
|
||||||
|
|
||||||
describe('Notifications', () => {
|
describe.only('Notifications', () => {
|
||||||
let store;
|
let store;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -29,7 +30,9 @@ describe('Notifications', () => {
|
|||||||
'user:fetch': () => {},
|
'user:fetch': () => {},
|
||||||
'tasks:fetchUserTasks': () => {},
|
'tasks:fetchUserTasks': () => {},
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {
|
||||||
|
'members:hasClass': hasClass,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ export default {
|
|||||||
return !this.user.flags.classSelected && this.user.stats.lvl >= 10;
|
return !this.user.flags.classSelected && this.user.stats.lvl >= 10;
|
||||||
},
|
},
|
||||||
userHasClass () {
|
userHasClass () {
|
||||||
return this.user.stats.lvl >= 10 && this.user.flags.classSelected && !this.user.preferences.disableClasses;
|
return this.$store.getters['members:hasClass'](this.user);
|
||||||
},
|
},
|
||||||
invitedToQuest () {
|
invitedToQuest () {
|
||||||
return this.user.party.quest.RSVPNeeded && !this.user.party.quest.completed;
|
return this.user.party.quest.RSVPNeeded && !this.user.party.quest.completed;
|
||||||
@@ -253,11 +253,9 @@ export default {
|
|||||||
},
|
},
|
||||||
userMp (after, before) {
|
userMp (after, before) {
|
||||||
if (after === before) return;
|
if (after === before) return;
|
||||||
if (!this.$store.getters['members:hasClass'](this.user)) return;
|
if (!this.userHasClass) return;
|
||||||
|
|
||||||
const mana = after - before;
|
const mana = after - before;
|
||||||
|
|
||||||
if (!this.userHasClass) return;
|
|
||||||
this.mp(mana);
|
this.mp(mana);
|
||||||
},
|
},
|
||||||
userLvl (after, before) {
|
userLvl (after, before) {
|
||||||
|
|||||||
Reference in New Issue
Block a user