changed test to 95%

This commit is contained in:
ogerly 2022-06-08 21:09:52 +02:00
parent a659ce2f19
commit 8294e9ca8f
6 changed files with 51 additions and 20 deletions

View File

@ -3,10 +3,11 @@ import ContributionLinkForm from './ContributionLinkForm.vue'
const localVue = global.localVue
global.alert = jest.fn()
const propsData = {
contributionLinkData: {},
}
jest.spyOn(window, 'alert').mockReturnValue()
const mocks = {
$t: jest.fn((t) => t),
@ -25,19 +26,39 @@ describe('ContributionLinkForm', () => {
})
it('renders the Div Element ".contribution-link-form"', () => {
expect(wrapper.find('div.contribution-link-form').exists()).toBeTruthy()
})
it('function onSubmit', () => {
wrapper.vm.onSubmit()
expect(wrapper.find('div.contribution-link-form').exists()).toBe(true)
})
it('function onReset', () => {
wrapper.vm.onReset()
beforeEach(() => {
wrapper.setData({
form: {
name: 'name',
memo: 'memo',
amount: 100,
startDate: 'startDate',
endDate: 'endDate',
cycle: 'cycle',
repetition: 'repetition',
maxAmount: 100,
},
})
wrapper.vm.onReset()
})
expect(wrapper.vm.form).toEqual({
amount: null,
cycle: null,
endDate: null,
maxAmount: null,
memo: null,
name: null,
repetition: null,
startDate: null,
})
})
it('function updateForm', () => {
wrapper.vm.updateForm()
it('onSubmit valid form', () => {
wrapper.vm.onSubmit()
})
})
})

View File

@ -134,7 +134,6 @@ export default {
min: new Date(),
cycle: [
{ value: null, text: this.$t('contributionLink.options.cycle.null') },
{ value: 'none', text: this.$t('contributionLink.options.cycle.none') },
{ value: 'hourly', text: this.$t('contributionLink.options.cycle.hourly') },
{ value: 'daily', text: this.$t('contributionLink.options.cycle.daily') },
{ value: 'weekly', text: this.$t('contributionLink.options.cycle.weekly') },
@ -142,7 +141,7 @@ export default {
{ value: 'yearly', text: this.$t('contributionLink.options.cycle.yearly') },
],
repetition: [
{ value: null, text: 'Please select an repetition' },
{ value: null, text: this.$t('contributionLink.options.repetition.null') },
{ value: '1', text: '1 x' },
{ value: '2', text: '2 x' },
{ value: '3', text: '3 x' },
@ -184,9 +183,6 @@ export default {
this.form.startDate = null
this.form.endDate = null
},
updateForm() {
alert('updateForm')
},
},
computed: {
updateData() {

View File

@ -69,6 +69,7 @@ const propsData = {
{ key: 'edit_creation', label: 'edit' },
{ key: 'confirm', label: 'save' },
],
toggleDetails: false,
}
const mocks = {
@ -125,5 +126,9 @@ describe('OpenCreationsTable', () => {
expect(wrapper.find('div.component-edit-creation-formular').exists()).toBeTruthy()
})
})
it('funtion updateUserData', () => {
wrapper.vm.updateUserData([111, 222, 333], [444, 555, 666])
})
})
})

View File

@ -70,12 +70,23 @@ export default {
required: true,
},
},
data() {
return {
creationUserData: {
amount: null,
date: null,
memo: null,
moderator: null,
},
}
},
methods: {
updateCreationData(data) {
this.creationUserData.amount = data.amount
this.creationUserData.date = data.date
this.creationUserData.memo = data.memo
this.creationUserData.moderator = data.moderator
this.creationUserData = data
// this.creationUserData.amount = data.amount
// this.creationUserData.date = data.date
// this.creationUserData.memo = data.memo
// this.creationUserData.moderator = data.moderator
data.row.toggleDetails()
},
updateUserData(rowItem, newCreation) {

View File

@ -21,7 +21,6 @@
"daily": "täglich",
"hourly": "stündlich",
"monthly": "monatlich",
"none": "kein Zyklus",
"null": "Bitter wähle einen Zyklus",
"weekly": "wöchentlich",
"yearly": "jährlich"

View File

@ -21,7 +21,6 @@
"daily": "daily",
"hourly": "hourly",
"monthly": "monthly",
"none": "no cycle",
"null": "please select a cycle",
"weekly": "weekly",
"yearly": "yearly"