Merge branch 'master' into 2590-To-long-text-has-submit-button-still-enabled

This commit is contained in:
Alexander Friedland 2023-02-10 15:23:38 +01:00 committed by GitHub
commit e22f085726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 176 additions and 196 deletions

View File

@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [1.18.1](https://github.com/gradido/gradido/compare/1.18.0...1.18.1)
- fix(frontend): fix is last month for empty form date [`#2697`](https://github.com/gradido/gradido/pull/2697)
- fix(frontend): community link [`#2696`](https://github.com/gradido/gradido/pull/2696)
#### [1.18.0](https://github.com/gradido/gradido/compare/1.17.1...1.18.0) #### [1.18.0](https://github.com/gradido/gradido/compare/1.17.1...1.18.0)
> 9 February 2023
- feat(release): version 1.18.0 [`#2690`](https://github.com/gradido/gradido/pull/2690)
- refactor(frontend): toast by automatically logged out [`#2681`](https://github.com/gradido/gradido/pull/2681) - refactor(frontend): toast by automatically logged out [`#2681`](https://github.com/gradido/gradido/pull/2681)
- refactor(frontend): change text for gdd_per_link.choose-amount [`#2638`](https://github.com/gradido/gradido/pull/2638) - refactor(frontend): change text for gdd_per_link.choose-amount [`#2638`](https://github.com/gradido/gradido/pull/2638)
- fix(backend): emails for deny and delete contribution [`#2688`](https://github.com/gradido/gradido/pull/2688) - fix(backend): emails for deny and delete contribution [`#2688`](https://github.com/gradido/gradido/pull/2688)

View File

@ -3,7 +3,7 @@
"description": "Administraion Interface for Gradido", "description": "Administraion Interface for Gradido",
"main": "index.js", "main": "index.js",
"author": "Moriz Wahl", "author": "Moriz Wahl",
"version": "1.18.0", "version": "1.18.1",
"license": "Apache-2.0", "license": "Apache-2.0",
"private": false, "private": false,
"scripts": { "scripts": {

View File

@ -1,6 +1,6 @@
{ {
"name": "gradido-backend", "name": "gradido-backend",
"version": "1.18.0", "version": "1.18.1",
"description": "Gradido unified backend providing an API-Service for Gradido Transactions", "description": "Gradido unified backend providing an API-Service for Gradido Transactions",
"main": "src/index.ts", "main": "src/index.ts",
"repository": "https://github.com/gradido/gradido/backend", "repository": "https://github.com/gradido/gradido/backend",

View File

@ -1,6 +1,6 @@
{ {
"name": "gradido-database", "name": "gradido-database",
"version": "1.18.0", "version": "1.18.1",
"description": "Gradido Database Tool to execute database migrations", "description": "Gradido Database Tool to execute database migrations",
"main": "src/index.ts", "main": "src/index.ts",
"repository": "https://github.com/gradido/gradido/database", "repository": "https://github.com/gradido/gradido/database",

View File

@ -1,6 +1,6 @@
{ {
"name": "bootstrap-vue-gradido-wallet", "name": "bootstrap-vue-gradido-wallet",
"version": "1.18.0", "version": "1.18.1",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "node run/server.js", "start": "node run/server.js",

View File

@ -24,11 +24,6 @@ describe('ContributionForm', () => {
$t: jest.fn((t) => t), $t: jest.fn((t) => t),
$d: jest.fn((d) => d), $d: jest.fn((d) => d),
$n: jest.fn((n) => n), $n: jest.fn((n) => n),
$store: {
state: {
creation: ['1000', '1000', '1000'],
},
},
$i18n: { $i18n: {
locale: 'en', locale: 'en',
}, },
@ -61,7 +56,7 @@ describe('ContributionForm', () => {
}) })
}) })
describe('dates', () => { describe('dates and max amounts', () => {
beforeEach(async () => { beforeEach(async () => {
await wrapper.setData({ await wrapper.setData({
form: { form: {
@ -73,204 +68,176 @@ describe('ContributionForm', () => {
}) })
}) })
describe('actual date', () => { describe('max amount reached for both months', () => {
describe('same month', () => { beforeEach(() => {
wrapper.setProps({
maxGddLastMonth: 0,
maxGddThisMonth: 0,
})
wrapper.setData({
form: {
id: null,
date: 'set',
memo: '',
amount: '',
},
})
})
it('shows message that no contributions are available', () => {
expect(wrapper.find('[data-test="contribtion-message"]').text()).toBe(
'contribution.noOpenCreation.allMonth',
)
})
})
describe('max amount reached for last month, no date selected', () => {
beforeEach(() => {
wrapper.setProps({
maxGddLastMonth: 0,
})
})
it('shows no message', () => {
expect(wrapper.find('[data-test="contribtion-message"]').exists()).toBe(false)
})
})
describe('max amount reached for last month, last month selected', () => {
beforeEach(async () => { beforeEach(async () => {
const now = new Date().toISOString() wrapper.setProps({
await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) maxGddLastMonth: 0,
isThisMonth: false,
}) })
describe('isThisMonth', () => {
it('has true', () => {
expect(wrapper.vm.isThisMonth).toBe(true)
})
})
})
describe.skip('month before', () => {
beforeEach(async () => {
await wrapper
.findComponent({ name: 'BFormDatepicker' })
.vm.$emit('input', wrapper.vm.minimalDate)
})
describe('isThisMonth', () => {
it('has false', () => {
expect(wrapper.vm.isThisMonth).toBe(false)
})
})
})
})
describe.skip('date in middle of year', () => {
describe('same month', () => {
beforeEach(async () => {
// jest.useFakeTimers('modern')
// jest.setSystemTime(new Date('2020-07-06'))
// await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now)
await wrapper.setData({ await wrapper.setData({
maximalDate: new Date(2020, 6, 6), form: {
form: { date: new Date(2020, 6, 6) }, id: null,
date: 'set',
memo: '',
amount: '',
},
}) })
}) })
describe('minimalDate', () => { it('shows message that no contributions are available for last month', () => {
it('has "2020-06-01T00:00:00.000Z"', () => { expect(wrapper.find('[data-test="contribtion-message"]').text()).toBe(
expect(wrapper.vm.minimalDate.toISOString()).toBe('2020-06-01T00:00:00.000Z') 'contribution.noOpenCreation.lastMonth',
)
}) })
}) })
describe('isThisMonth', () => { describe('max amount reached for last month, this month selected', () => {
it('has true', () => {
expect(wrapper.vm.isThisMonth).toBe(true)
})
})
})
describe('month before', () => {
beforeEach(async () => { beforeEach(async () => {
// jest.useFakeTimers('modern') wrapper.setProps({
// jest.setSystemTime(new Date('2020-07-06')) maxGddLastMonth: 0,
// console.log('middle of year date now:', wrapper.vm.minimalDate) isThisMonth: true,
// await wrapper })
// .findComponent({ name: 'BFormDatepicker' })
// .vm.$emit('input', wrapper.vm.minimalDate)
await wrapper.setData({ await wrapper.setData({
maximalDate: new Date(2020, 6, 6), form: {
form: { date: new Date(2020, 5, 6) }, id: null,
date: 'set',
memo: '',
amount: '',
},
}) })
}) })
describe('minimalDate', () => { it('shows no message', () => {
it('has "2020-06-01T00:00:00.000Z"', () => { expect(wrapper.find('[data-test="contribtion-message"]').exists()).toBe(false)
expect(wrapper.vm.minimalDate.toISOString()).toBe('2020-06-01T00:00:00.000Z')
}) })
}) })
describe('isThisMonth', () => { describe('max amount reached for this month, no date selected', () => {
it('has false', () => { beforeEach(() => {
expect(wrapper.vm.isThisMonth).toBe(false) wrapper.setProps({
}) maxGddThisMonth: 0,
})
}) })
}) })
describe.skip('date in january', () => { it('shows no message', () => {
describe('same month', () => { expect(wrapper.find('[data-test="contribtion-message"]').exists()).toBe(false)
})
})
describe('max amount reached for this month, this month selected', () => {
beforeEach(async () => { beforeEach(async () => {
wrapper.setProps({
maxGddThisMonth: 0,
isThisMonth: true,
})
await wrapper.setData({ await wrapper.setData({
maximalDate: new Date(2020, 0, 6), form: {
form: { date: new Date(2020, 0, 6) }, id: null,
date: 'set',
memo: '',
amount: '',
},
}) })
}) })
describe('minimalDate', () => { it('shows message that no contributions are available for last month', () => {
it('has "2019-12-01T00:00:00.000Z"', () => { expect(wrapper.find('[data-test="contribtion-message"]').text()).toBe(
expect(wrapper.vm.minimalDate.toISOString()).toBe('2019-12-01T00:00:00.000Z') 'contribution.noOpenCreation.thisMonth',
)
}) })
}) })
describe('isThisMonth', () => { describe('max amount reached for this month, last month selected', () => {
it('has true', () => {
expect(wrapper.vm.isThisMonth).toBe(true)
})
})
})
describe('month before', () => {
beforeEach(async () => { beforeEach(async () => {
// jest.useFakeTimers('modern') wrapper.setProps({
// jest.setSystemTime(new Date('2020-07-06')) maxGddThisMonth: 0,
// console.log('middle of year date now:', wrapper.vm.minimalDate) isThisMonth: false,
// await wrapper })
// .findComponent({ name: 'BFormDatepicker' })
// .vm.$emit('input', wrapper.vm.minimalDate)
await wrapper.setData({ await wrapper.setData({
maximalDate: new Date(2020, 0, 6), form: {
form: { date: new Date(2019, 11, 6) }, id: null,
date: 'set',
memo: '',
amount: '',
},
}) })
}) })
describe('minimalDate', () => { it('shows no message', () => {
it('has "2019-12-01T00:00:00.000Z"', () => { expect(wrapper.find('[data-test="contribtion-message"]').exists()).toBe(false)
expect(wrapper.vm.minimalDate.toISOString()).toBe('2019-12-01T00:00:00.000Z')
})
})
describe('isThisMonth', () => {
it('has false', () => {
expect(wrapper.vm.isThisMonth).toBe(false)
})
}) })
}) })
}) })
describe.skip('date with the 31st day of the month', () => { describe('default return message', () => {
describe('same month', () => { it('returns an empty string', () => {
beforeEach(async () => { expect(wrapper.vm.noOpenCreation).toBe('')
await wrapper.setData({
maximalDate: new Date('2022-10-31T00:00:00.000Z'),
form: { date: new Date('2022-10-31T00:00:00.000Z') },
}) })
}) })
describe('minimalDate', () => { describe('update amount', () => {
it('has "2022-09-01T00:00:00.000Z"', () => { beforeEach(() => {
expect(wrapper.vm.minimalDate.toISOString()).toBe('2022-09-01T00:00:00.000Z') wrapper.findComponent({ name: 'InputHour' }).vm.$emit('updateAmount', 20)
})
it('updates form amount', () => {
expect(wrapper.vm.form.amount).toBe('400.00')
}) })
}) })
describe('isThisMonth', () => { describe('watch value', () => {
it('has true', () => { beforeEach(() => {
expect(wrapper.vm.isThisMonth).toBe(true) wrapper.setProps({
}) value: {
}) id: 42,
date: 'set',
memo: 'Some Memo',
amount: '400.00',
},
}) })
}) })
describe.skip('date with the 28th day of the month', () => { it('updates form', () => {
describe('same month', () => { expect(wrapper.vm.form).toEqual({
beforeEach(async () => { id: 42,
await wrapper.setData({ date: 'set',
maximalDate: new Date('2023-02-28T00:00:00.000Z'), memo: 'Some Memo',
form: { date: new Date('2023-02-28T00:00:00.000Z') }, amount: '400.00',
})
})
describe('minimalDate', () => {
it('has "2023-01-01T00:00:00.000Z"', () => {
expect(wrapper.vm.minimalDate.toISOString()).toBe('2023-01-01T00:00:00.000Z')
})
})
describe('isThisMonth', () => {
it('has true', () => {
expect(wrapper.vm.isThisMonth).toBe(true)
})
})
})
})
describe.skip('date with 29.02.2024 leap year', () => {
describe('same month', () => {
beforeEach(async () => {
await wrapper.setData({
maximalDate: new Date('2024-02-29T00:00:00.000Z'),
form: { date: new Date('2024-02-29T00:00:00.000Z') },
})
})
describe('minimalDate', () => {
it('has "2024-01-01T00:00:00.000Z"', () => {
expect(wrapper.vm.minimalDate.toISOString()).toBe('2024-01-01T00:00:00.000Z')
})
})
describe('isThisMonth', () => {
it('has true', () => {
expect(wrapper.vm.isThisMonth).toBe(true)
})
})
}) })
}) })
}) })
@ -477,24 +444,23 @@ describe('ContributionForm', () => {
}) })
}) })
describe.skip('on trigger submit', () => { describe('on trigger submit', () => {
beforeEach(async () => { beforeEach(async () => {
await wrapper.find('form').trigger('submit') await wrapper.find('form').trigger('submit')
}) })
it('emits "update-contribution"', () => { it('emits "update-contribution"', () => {
expect(wrapper.emitted('update-contribution')).toEqual( expect(wrapper.emitted('update-contribution')).toEqual([
expect.arrayContaining([ [
expect.arrayContaining([
{ {
id: 2, id: 2,
date: now, date: now,
hours: 0,
memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...',
amount: '200', amount: '200',
}, },
]), ],
]), ])
)
}) })
}) })
}) })

View File

@ -23,10 +23,7 @@
<template #nav-next-year><span></span></template> <template #nav-next-year><span></span></template>
</b-form-datepicker> </b-form-datepicker>
<div <div v-if="showMessage" class="p-3" data-test="contribtion-message">
v-if="(isThisMonth && maxGddThisMonth <= 0) || (!isThisMonth && maxGddLastMonth <= 0)"
class="p-3"
>
{{ noOpenCreation }} {{ noOpenCreation }}
</div> </div>
<div v-else> <div v-else>
@ -118,8 +115,8 @@ export default {
} }
}, },
methods: { methods: {
updateAmount(amount) { updateAmount(hours) {
this.form.amount = (amount * 20).toFixed(2).toString() this.form.amount = (hours * 20).toFixed(2).toString()
}, },
submit() { submit() {
this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form }) this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form })
@ -135,6 +132,15 @@ export default {
}, },
}, },
computed: { computed: {
showMessage() {
if (this.maxGddThisMonth <= 0 && this.maxGddLastMonth <= 0) return true
if (this.form.date)
return (
(this.isThisMonth && this.maxGddThisMonth <= 0) ||
(!this.isThisMonth && this.maxGddLastMonth <= 0)
)
return false
},
disabled() { disabled() {
return ( return (
this.form.date === '' || this.form.date === '' ||

View File

@ -6,9 +6,9 @@
{{ CONFIG.COMMUNITY_DESCRIPTION }} {{ CONFIG.COMMUNITY_DESCRIPTION }}
</div> </div>
<div> <div>
<router-link :to="CONFIG.COMMUNITY_URL"> <b-link :href="CONFIG.COMMUNITY_URL">
{{ CONFIG.COMMUNITY_URL }} {{ CONFIG.COMMUNITY_URL }}
</router-link> </b-link>
</div> </div>
<hr /> <hr />
<div class="h3">{{ $t('community.openContributionLinks') }}</div> <div class="h3">{{ $t('community.openContributionLinks') }}</div>

View File

@ -1,6 +1,6 @@
{ {
"name": "gradido", "name": "gradido",
"version": "1.18.0", "version": "1.18.1",
"description": "Gradido", "description": "Gradido",
"main": "index.js", "main": "index.js",
"repository": "git@github.com:gradido/gradido.git", "repository": "git@github.com:gradido/gradido.git",