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

View File

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

View File

@ -49,7 +49,7 @@ const routes = [
component: () => import('../views/Pages/ForgotPassword.vue'),
},
{
path: '/regist-community',
path: '/register-community',
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', () => {
it('has a link "Forgot Password?"', () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual(
@ -94,7 +106,9 @@ describe('Login', () => {
})
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-card no-body class="border-0 mb-0" style="background-color: #ebebeba3 !important">
<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>
<p class="text-lead">
{{ $store.state.community.description }}
@ -53,7 +53,7 @@
class="text-center text-sm-right col-12 col-sm-6"
v-show="allowRegister"
>
<router-link to="/regist-community" class="mt-3">
<router-link to="/register-community" class="mt-3">
{{ $t('site.login.new_wallet') }}
</router-link>
</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', () => {
it('has a link "Back"', () => {
expect(wrapper.find('.test-button-back').text()).toEqual('back')

View File

@ -22,7 +22,7 @@
<b-col lg="6" md="8">
<b-card no-body class="border-0" style="background-color: #ebebeba3 !important">
<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>
<p class="text-lead">
{{ $store.state.community.description }}

View File

@ -49,7 +49,7 @@ describe('RegisterCommunity', () => {
it('has a current community location', () => {
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">
{{ $store.state.community.description }}
</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-row>
<b-row>

View File

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

View File

@ -3,9 +3,9 @@
<b-container class="text-center">
<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
v-show="community.name === $store.state.community.name"
v-if="community.name === $store.state.community.name"
class="border-0 mb-0"
bg-variant="primary"
>
@ -23,13 +23,13 @@
<div>{{ $t('community.other-communities') }}</div>
<div v-for="community in communitys.community" :key="community.id" class="pb-3">
<b-card v-show="community.name != $store.state.community.name" bg-variant="secondary">
<div v-for="community in communities.community" :key="community.id" class="pb-3">
<b-card v-if="community.name != $store.state.community.name" bg-variant="secondary">
<b>{{ community.name }}</b>
<br />
{{ community.description }}
<br />
Location:
{{ $t('community.location') }}
<b>
<small>
<b-link :href="community.url">{{ community.url }}</b-link>
@ -49,13 +49,13 @@
</div>
</template>
<script>
import MyCommunitys from '../../../public/json-example/communitys.json'
import MyCommunities from '../../../public/json-example/communities.json'
export default {
name: 'registerSelectCommunity',
data() {
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,4 +1,5 @@
<template>
<div class="userdata-card">
<b-card class="bg-transparent border-0">
<div class="w-100 text-center">
<vue-qrcode
@ -25,6 +26,7 @@
</div>
</div>
</b-card>
</div>
</template>
<script>
import VueQrcode from 'vue-qrcode'