mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
client: add missing test files and use v-once
This commit is contained in:
19
test/client/unit/specs/plugins/i18n.spec.js
Normal file
19
test/client/unit/specs/plugins/i18n.spec.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import i18n from 'client/plugins/i18n';
|
||||||
|
import commoni18n from 'common/script/i18n';
|
||||||
|
import Vue from 'vue';
|
||||||
|
|
||||||
|
describe('i18n plugin', () => {
|
||||||
|
before(() => {
|
||||||
|
i18n.install(Vue);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('adds $t to Vue.prototype', () => {
|
||||||
|
expect(Vue.prototype.$t).to.be.a.function;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('$t is a proxy for common/i18n.t', () => {
|
||||||
|
const result = (new Vue()).$t('reportBug');
|
||||||
|
expect(result).to.equal(commoni18n.t('reportBug'));
|
||||||
|
expect(result).to.equal('Report a Bug');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -3,29 +3,45 @@
|
|||||||
#app-menu.ui.top.fixed.menu
|
#app-menu.ui.top.fixed.menu
|
||||||
.header.item
|
.header.item
|
||||||
img(src="~assets/header/png/logo@3x.png")
|
img(src="~assets/header/png/logo@3x.png")
|
||||||
router-link.item(to="/", exact) {{ $t('tasks') }}
|
router-link.item(to="/", exact)
|
||||||
|
span(v-once) {{ $t('tasks') }}
|
||||||
// .simple makes it possible to have a dropdown without JS
|
// .simple makes it possible to have a dropdown without JS
|
||||||
.ui.simple.dropdown
|
.ui.simple.dropdown
|
||||||
router-link.item(to="/inventory", :class="{'active': $route.path.startsWith('/inventory')}") {{ $t('inventory') }}
|
router-link.item(to="/inventory", :class="{'active': $route.path.startsWith('/inventory')}")
|
||||||
|
span(v-once) {{ $t('inventory') }}
|
||||||
.menu
|
.menu
|
||||||
router-link.item(to="/inventory") {{ $t('inventory') }}
|
router-link.item(to="/inventory")
|
||||||
router-link.item(to="/inventory/stable") {{ $t('stable') }}
|
span(v-once) {{ $t('inventory') }}
|
||||||
router-link.item(to="/inventory/equipment") {{ $t('equipment') }}
|
router-link.item(to="/inventory/stable")
|
||||||
router-link.item(to="/market") {{ $t('market') }}
|
span(v-once) {{ $t('stable') }}
|
||||||
|
router-link.item(to="/inventory/equipment")
|
||||||
|
span(v-once) {{ $t('equipment') }}
|
||||||
|
router-link.item(to="/market")
|
||||||
|
span(v-once) {{ $t('market') }}
|
||||||
.ui.simple.dropdown
|
.ui.simple.dropdown
|
||||||
router-link.item(to="/social/tavern", :class="{'active': $route.path.startsWith('/social')}") {{ $t('social') }}
|
router-link.item(to="/social/tavern", :class="{'active': $route.path.startsWith('/social')}")
|
||||||
|
span(v-once) {{ $t('social') }}
|
||||||
.menu
|
.menu
|
||||||
router-link.item(to="/social/tavern") {{ $t('tavern') }}
|
router-link.item(to="/social/tavern")
|
||||||
router-link.item(to="/social/inbox") {{ $t('inbox') }}
|
span(v-once) {{ $t('tavern') }}
|
||||||
router-link.item(to="/social/challenges") {{ $t('challenges') }}
|
router-link.item(to="/social/inbox")
|
||||||
router-link.item(to="/social/party") {{ $t('party') }}
|
span(v-once) {{ $t('inbox') }}
|
||||||
router-link.item(to="/social/guilds") {{ $t('guilds') }}
|
router-link.item(to="/social/challenges")
|
||||||
|
span(v-once) {{ $t('challenges') }}
|
||||||
|
router-link.item(to="/social/party")
|
||||||
|
span(v-once) {{ $t('party') }}
|
||||||
|
router-link.item(to="/social/guilds")
|
||||||
|
span(v-once) {{ $t('guilds') }}
|
||||||
.ui.simple.dropdown
|
.ui.simple.dropdown
|
||||||
router-link.item(to="/help", :class="{'active': $route.path.startsWith('/help')}") {{ $t('help') }}
|
router-link.item(to="/help", :class="{'active': $route.path.startsWith('/help')}")
|
||||||
|
span(v-once) {{ $t('help') }}
|
||||||
.menu
|
.menu
|
||||||
router-link.item(to="/help/faq") {{ $t('faq') }}
|
router-link.item(to="/help/faq")
|
||||||
router-link.item(to="/help/report-bug") {{ $t('reportBug') }}
|
span(v-once) {{ $t('faq') }}
|
||||||
router-link.item(to="/help/request-feature") {{ $t('requestAF') }}
|
router-link.item(to="/help/report-bug")
|
||||||
|
span(v-once) {{ $t('reportBug') }}
|
||||||
|
router-link.item(to="/help/request-feature")
|
||||||
|
span(v-once) {{ $t('requestAF') }}
|
||||||
.right.menu
|
.right.menu
|
||||||
.item.with-img
|
.item.with-img
|
||||||
img(src="~assets/header/png/gem@3x.png")
|
img(src="~assets/header/png/gem@3x.png")
|
||||||
@@ -42,14 +58,18 @@
|
|||||||
.menu
|
.menu
|
||||||
.item.user-edit-avatar
|
.item.user-edit-avatar
|
||||||
strong {{user.profile.name}}
|
strong {{user.profile.name}}
|
||||||
a Edit avatar
|
a(v-once) {{ $t('editAvatar') }}
|
||||||
.divider
|
.divider
|
||||||
router-link.item(to="/user/stats") Stats
|
router-link.item(to="/user/stats")
|
||||||
router-link.item(to="/user/achievements") Achievements
|
span(v-once) {{ $t('stats') }}
|
||||||
|
router-link.item(to="/user/achievements")
|
||||||
|
span(v-once) {{ $t('achievements') }}
|
||||||
.divider
|
.divider
|
||||||
router-link.item(to="/user/settings") Settings
|
router-link.item(to="/user/settings")
|
||||||
|
span(v-once) {{ $t('settings') }}
|
||||||
.divider
|
.divider
|
||||||
router-link.item(to="/logout") Logout
|
router-link.item(to="/logout")
|
||||||
|
span(v-once) {{ $t('logout') }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
@@ -131,10 +151,6 @@
|
|||||||
box-shadow: 0px -4px 0px #6133b4 inset;
|
box-shadow: 0px -4px 0px #6133b4 inset;
|
||||||
}
|
}
|
||||||
|
|
||||||
#app-menu > .dropdown > .item.active {
|
|
||||||
// font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app-menu > .dropdown > .menu {
|
#app-menu > .dropdown > .menu {
|
||||||
border: none;
|
border: none;
|
||||||
background-color: rgba(0, 0, 0, 0.5); // transparent
|
background-color: rgba(0, 0, 0, 0.5); // transparent
|
||||||
@@ -152,7 +168,7 @@
|
|||||||
padding: 6px 0px 6px 20px !important;
|
padding: 6px 0px 6px 20px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#app-menu > .dropdown .menu > .item.active {
|
#app-menu .dropdown .menu .item.active {
|
||||||
font-weight: normal !important;
|
font-weight: normal !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user