Merge branch 'master' into 2283-feature-fullstack-tests-as-github-workflow

This commit is contained in:
mahula 2022-11-01 15:04:47 +01:00 committed by GitHub
commit beab2f9e91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 13 deletions

View File

@ -5,15 +5,23 @@
<contribution-messages-list-item :message="message" />
</div>
</b-container>
<contribution-messages-formular
v-if="['PENDING', 'IN_PROGRESS'].includes(state)"
:contributionId="contributionId"
@get-list-contribution-messages="getListContributionMessages"
@update-state="updateState"
/>
<div v-b-toggle="'collapse' + String(contributionId)" class="text-center pointer h2">
<b-icon icon="arrow-up-short"></b-icon>
{{ $t('form.close') }}
<b-container>
<contribution-messages-formular
v-if="['PENDING', 'IN_PROGRESS'].includes(state)"
:contributionId="contributionId"
@get-list-contribution-messages="getListContributionMessages"
@update-state="updateState"
/>
</b-container>
<div
v-b-toggle="'collapse' + String(contributionId)"
class="text-center pointer h2 clearboth pt-1"
>
<b-button variant="outline-primary" block class="mt-4">
<b-icon icon="arrow-up-short"></b-icon>
{{ $t('form.close') }}
</b-button>
</div>
</div>
</template>
@ -55,4 +63,7 @@ export default {
.temp-message {
margin-top: 50px;
}
.clearboth {
clear: both;
}
</style>

View File

@ -198,6 +198,75 @@ describe('ContributionForm', () => {
})
})
})
describe('date with the 31st day of the month', () => {
describe('same month', () => {
beforeEach(async () => {
await wrapper.setData({
maximalDate: new Date('2022-10-31T00:00:00.000Z'),
form: { date: new Date('2022-10-31T00:00:00.000Z') },
})
})
describe('minimalDate', () => {
it('has "2022-09-01T00:00:00.000Z"', () => {
expect(wrapper.vm.minimalDate.toISOString()).toBe('2022-09-01T00:00:00.000Z')
})
})
describe('isThisMonth', () => {
it('has true', () => {
expect(wrapper.vm.isThisMonth).toBe(true)
})
})
})
})
describe('date with the 28th day of the month', () => {
describe('same month', () => {
beforeEach(async () => {
await wrapper.setData({
maximalDate: new Date('2023-02-28T00:00:00.000Z'),
form: { date: new Date('2023-02-28T00:00:00.000Z') },
})
})
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('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)
})
})
})
})
})
describe('set contrubtion', () => {

View File

@ -131,10 +131,8 @@ export default {
},
computed: {
minimalDate() {
// sets the date to the 1st of the previous month
let date = new Date(this.maximalDate) // has to be a new object, because of 'setMonth' changes the objects date
date = new Date(date.setMonth(date.getMonth() - 1))
return new Date(date.getFullYear(), date.getMonth(), 1)
const date = new Date(this.maximalDate)
return new Date(date.setMonth(date.getMonth() - 1, 1))
},
disabled() {
return (