changes review, fix lint, fix locales, fix test

This commit is contained in:
ogerly 2021-09-30 22:57:20 +02:00
parent 1c2155b7b8
commit 4ce456d459
14 changed files with 111 additions and 42 deletions

View File

@ -2,8 +2,7 @@
"back": "Zurück", "back": "Zurück",
"community": { "community": {
"choose-another-community": "Eine andere Gemeinschaft auswählen", "choose-another-community": "Eine andere Gemeinschaft auswählen",
"community": "Gemeinschaft", "communities": {
"communitys": {
"form": { "form": {
"date_period": "Datum / Zeitraum", "date_period": "Datum / Zeitraum",
"hours": "Stunden", "hours": "Stunden",
@ -12,8 +11,10 @@
"submit": "Einreichen" "submit": "Einreichen"
} }
}, },
"community": "Gemeinschaft",
"continue-to-registration": "Weiter zur Registrierung", "continue-to-registration": "Weiter zur Registrierung",
"current-community": "Aktuelle Gemeinschaft", "current-community": "Aktuelle Gemeinschaft",
"location": "Ort:",
"other-communities": "Weitere Gemeinschaften", "other-communities": "Weitere Gemeinschaften",
"switch-to-this-community": "zu dieser Gemeinschaft wechseln" "switch-to-this-community": "zu dieser Gemeinschaft wechseln"
}, },

View File

@ -2,8 +2,7 @@
"back": "Back", "back": "Back",
"community": { "community": {
"choose-another-community": "Choose another community", "choose-another-community": "Choose another community",
"community": "Community", "communities": {
"communitys": {
"form": { "form": {
"date_period": "Date / Period", "date_period": "Date / Period",
"hours": "hours", "hours": "hours",
@ -12,8 +11,10 @@
"submit": "submit" "submit": "submit"
} }
}, },
"community": "Community",
"continue-to-registration": "Continue to registration", "continue-to-registration": "Continue to registration",
"current-community": "Current community", "current-community": "Current community",
"location": "Location:",
"other-communities": "Other communities", "other-communities": "Other communities",
"switch-to-this-community": "switch to this community" "switch-to-this-community": "switch to this community"
}, },

View File

@ -49,7 +49,7 @@ const routes = [
component: () => import('../views/Pages/ForgotPassword.vue'), component: () => import('../views/Pages/ForgotPassword.vue'),
}, },
{ {
path: '/regist-community', path: '/register-community',
component: () => import('../views/Pages/RegisterCommunity.vue'), component: () => import('../views/Pages/RegisterCommunity.vue'),
}, },
{ {

View File

@ -76,6 +76,18 @@ describe('Login', () => {
}) })
}) })
describe('Community Data', () => {
it('has a Community name?', () => {
expect(wrapper.find('.test-communitydata b').text()).toBe('Gradido Entwicklung')
})
it('has a Community description?', () => {
expect(wrapper.find('.test-communitydata p').text()).toBe(
'Die lokale Entwicklungsumgebung von Gradido.',
)
})
})
describe('links', () => { describe('links', () => {
it('has a link "Forgot Password?"', () => { it('has a link "Forgot Password?"', () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual( expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual(
@ -94,7 +106,9 @@ describe('Login', () => {
}) })
it('links to /register when clicking "Create new account"', () => { it('links to /register when clicking "Create new account"', () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(1).props().to).toBe('/regist-community') expect(wrapper.findAllComponents(RouterLinkStub).at(1).props().to).toBe(
'/register-community',
)
}) })
}) })

View File

@ -18,7 +18,7 @@
<b-col lg="5" md="7"> <b-col lg="5" md="7">
<b-card no-body class="border-0 mb-0" style="background-color: #ebebeba3 !important"> <b-card no-body class="border-0 mb-0" style="background-color: #ebebeba3 !important">
<b-card-body class="p-4"> <b-card-body class="p-4">
<div class="text-center text-muted mb-4"> <div class="text-center text-muted mb-4 test-communitydata">
<b>{{ $store.state.community.name }}</b> <b>{{ $store.state.community.name }}</b>
<p class="text-lead"> <p class="text-lead">
{{ $store.state.community.description }} {{ $store.state.community.description }}
@ -53,7 +53,7 @@
class="text-center text-sm-right col-12 col-sm-6" class="text-center text-sm-right col-12 col-sm-6"
v-show="allowRegister" v-show="allowRegister"
> >
<router-link to="/regist-community" class="mt-3"> <router-link to="/register-community" class="mt-3">
{{ $t('site.login.new_wallet') }} {{ $t('site.login.new_wallet') }}
</router-link> </router-link>
</b-col> </b-col>

View File

@ -59,6 +59,18 @@ describe('Register', () => {
}) })
}) })
describe('Community Data', () => {
it('has a Community name?', () => {
expect(wrapper.find('.test-communitydata b').text()).toBe('Gradido Entwicklung')
})
it('has a Community description?', () => {
expect(wrapper.find('.test-communitydata p').text()).toBe(
'Die lokale Entwicklungsumgebung von Gradido.',
)
})
})
describe('links', () => { describe('links', () => {
it('has a link "Back"', () => { it('has a link "Back"', () => {
expect(wrapper.find('.test-button-back').text()).toEqual('back') expect(wrapper.find('.test-button-back').text()).toEqual('back')

View File

@ -22,7 +22,7 @@
<b-col lg="6" md="8"> <b-col lg="6" md="8">
<b-card no-body class="border-0" style="background-color: #ebebeba3 !important"> <b-card no-body class="border-0" style="background-color: #ebebeba3 !important">
<b-card-body class="p-4"> <b-card-body class="p-4">
<div class="text-center text-muted mb-4"> <div class="text-center text-muted mb-4 test-communitydata">
<b>{{ $store.state.community.name }}</b> <b>{{ $store.state.community.name }}</b>
<p class="text-lead"> <p class="text-lead">
{{ $store.state.community.description }} {{ $store.state.community.description }}

View File

@ -49,7 +49,7 @@ describe('RegisterCommunity', () => {
it('has a current community location', () => { it('has a current community location', () => {
expect(wrapper.find('.header p.community-location').text()).toBe( expect(wrapper.find('.header p.community-location').text()).toBe(
'Location: http://localhost:3000/vue/', 'community.location http://localhost:3000/vue/',
) )
}) })
}) })

View File

@ -10,7 +10,9 @@
<p class="text-lead"> <p class="text-lead">
{{ $store.state.community.description }} {{ $store.state.community.description }}
</p> </p>
<p class="text-lead community-location">Location: {{ $store.state.community.url }}</p> <p class="text-lead community-location">
{{ $t('community.location') }} {{ $store.state.community.url }}
</p>
</b-col> </b-col>
</b-row> </b-row>
<b-row> <b-row>

View File

@ -1,5 +1,6 @@
import { mount } from '@vue/test-utils' import { mount } from '@vue/test-utils'
import RegisterSelectCommunity from './RegisterSelectCommunity' import RegisterSelectCommunity from './RegisterSelectCommunity'
// const testObject = require('../../../public/json-example/communities.json')
const localVue = global.localVue const localVue = global.localVue

View File

@ -3,9 +3,9 @@
<b-container class="text-center"> <b-container class="text-center">
<div class="pb-3">{{ $t('community.current-community') }}</div> <div class="pb-3">{{ $t('community.current-community') }}</div>
<div v-for="community in communitys.community" :key="community.name"> <div v-for="community in communities.community" :key="community.name">
<b-card <b-card
v-show="community.name === $store.state.community.name" v-if="community.name === $store.state.community.name"
class="border-0 mb-0" class="border-0 mb-0"
bg-variant="primary" bg-variant="primary"
> >
@ -23,13 +23,13 @@
<div>{{ $t('community.other-communities') }}</div> <div>{{ $t('community.other-communities') }}</div>
<div v-for="community in communitys.community" :key="community.id" class="pb-3"> <div v-for="community in communities.community" :key="community.id" class="pb-3">
<b-card v-show="community.name != $store.state.community.name" bg-variant="secondary"> <b-card v-if="community.name != $store.state.community.name" bg-variant="secondary">
<b>{{ community.name }}</b> <b>{{ community.name }}</b>
<br /> <br />
{{ community.description }} {{ community.description }}
<br /> <br />
Location: {{ $t('community.location') }}
<b> <b>
<small> <small>
<b-link :href="community.url">{{ community.url }}</b-link> <b-link :href="community.url">{{ community.url }}</b-link>
@ -49,13 +49,13 @@
</div> </div>
</template> </template>
<script> <script>
import MyCommunitys from '../../../public/json-example/communitys.json' import MyCommunities from '../../../public/json-example/communities.json'
export default { export default {
name: 'registerSelectCommunity', name: 'registerSelectCommunity',
data() { data() {
return { return {
communitys: MyCommunitys, communities: MyCommunities,
} }
}, },
} }

View File

@ -0,0 +1,36 @@
import { mount } from '@vue/test-utils'
import UserCard from './UserCard'
const localVue = global.localVue
describe('UserCard', () => {
let wrapper
const mocks = {
$t: jest.fn((t) => t),
$n: jest.fn((n) => String(n)),
$store: {
state: {
email: 'user@example.org',
},
},
}
const Wrapper = () => {
return mount(UserCard, { localVue, mocks })
}
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('renders the Div Element ".userdata-card"', () => {
expect(wrapper.find('div.userdata-card').exists()).toBeTruthy()
})
it('renders the Div Element "vue-qrcode"', () => {
expect(wrapper.find('vue-qrcode'))
})
})
})

View File

@ -1,30 +1,32 @@
<template> <template>
<b-card class="bg-transparent border-0"> <div class="userdata-card">
<div class="w-100 text-center"> <b-card class="bg-transparent border-0">
<vue-qrcode <div class="w-100 text-center">
v-if="$store.state.email" <vue-qrcode
:value="$store.state.email" v-if="$store.state.email"
type="image/png" :value="$store.state.email"
></vue-qrcode> type="image/png"
</div> ></vue-qrcode>
</div>
<div class="card-profile-stats d-flex justify-content-center mt-md-5"> <div class="card-profile-stats d-flex justify-content-center mt-md-5">
<div> <div>
<span class="heading"> <span class="heading">
{{ $n(balance, 'decimal') }} {{ $n(balance, 'decimal') }}
</span> </span>
<span class="description">GDD</span> <span class="description">GDD</span>
</div>
<div>
<span class="heading">{{ transactionCount }}</span>
<span class="description">{{ $t('transactions') }}</span>
</div>
<div>
<span class="heading">--</span>
<span class="description">{{ $t('community.community') }}</span>
</div>
</div> </div>
<div> </b-card>
<span class="heading">{{ transactionCount }}</span> </div>
<span class="description">{{ $t('transactions') }}</span>
</div>
<div>
<span class="heading">--</span>
<span class="description">{{ $t('community.community') }}</span>
</div>
</div>
</b-card>
</template> </template>
<script> <script>
import VueQrcode from 'vue-qrcode' import VueQrcode from 'vue-qrcode'