mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
changed test to 95%
This commit is contained in:
parent
a659ce2f19
commit
8294e9ca8f
@ -3,10 +3,11 @@ import ContributionLinkForm from './ContributionLinkForm.vue'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
|
global.alert = jest.fn()
|
||||||
|
|
||||||
const propsData = {
|
const propsData = {
|
||||||
contributionLinkData: {},
|
contributionLinkData: {},
|
||||||
}
|
}
|
||||||
jest.spyOn(window, 'alert').mockReturnValue()
|
|
||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn((t) => t),
|
||||||
@ -25,19 +26,39 @@ describe('ContributionLinkForm', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders the Div Element ".contribution-link-form"', () => {
|
it('renders the Div Element ".contribution-link-form"', () => {
|
||||||
expect(wrapper.find('div.contribution-link-form').exists()).toBeTruthy()
|
expect(wrapper.find('div.contribution-link-form').exists()).toBe(true)
|
||||||
})
|
|
||||||
|
|
||||||
it('function onSubmit', () => {
|
|
||||||
wrapper.vm.onSubmit()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('function onReset', () => {
|
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', () => {
|
it('onSubmit valid form', () => {
|
||||||
wrapper.vm.updateForm()
|
wrapper.vm.onSubmit()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -134,7 +134,6 @@ export default {
|
|||||||
min: new Date(),
|
min: new Date(),
|
||||||
cycle: [
|
cycle: [
|
||||||
{ value: null, text: this.$t('contributionLink.options.cycle.null') },
|
{ 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: 'hourly', text: this.$t('contributionLink.options.cycle.hourly') },
|
||||||
{ value: 'daily', text: this.$t('contributionLink.options.cycle.daily') },
|
{ value: 'daily', text: this.$t('contributionLink.options.cycle.daily') },
|
||||||
{ value: 'weekly', text: this.$t('contributionLink.options.cycle.weekly') },
|
{ value: 'weekly', text: this.$t('contributionLink.options.cycle.weekly') },
|
||||||
@ -142,7 +141,7 @@ export default {
|
|||||||
{ value: 'yearly', text: this.$t('contributionLink.options.cycle.yearly') },
|
{ value: 'yearly', text: this.$t('contributionLink.options.cycle.yearly') },
|
||||||
],
|
],
|
||||||
repetition: [
|
repetition: [
|
||||||
{ value: null, text: 'Please select an repetition' },
|
{ value: null, text: this.$t('contributionLink.options.repetition.null') },
|
||||||
{ value: '1', text: '1 x' },
|
{ value: '1', text: '1 x' },
|
||||||
{ value: '2', text: '2 x' },
|
{ value: '2', text: '2 x' },
|
||||||
{ value: '3', text: '3 x' },
|
{ value: '3', text: '3 x' },
|
||||||
@ -184,9 +183,6 @@ export default {
|
|||||||
this.form.startDate = null
|
this.form.startDate = null
|
||||||
this.form.endDate = null
|
this.form.endDate = null
|
||||||
},
|
},
|
||||||
updateForm() {
|
|
||||||
alert('updateForm')
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
updateData() {
|
updateData() {
|
||||||
|
|||||||
@ -69,6 +69,7 @@ const propsData = {
|
|||||||
{ key: 'edit_creation', label: 'edit' },
|
{ key: 'edit_creation', label: 'edit' },
|
||||||
{ key: 'confirm', label: 'save' },
|
{ key: 'confirm', label: 'save' },
|
||||||
],
|
],
|
||||||
|
toggleDetails: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
@ -125,5 +126,9 @@ describe('OpenCreationsTable', () => {
|
|||||||
expect(wrapper.find('div.component-edit-creation-formular').exists()).toBeTruthy()
|
expect(wrapper.find('div.component-edit-creation-formular').exists()).toBeTruthy()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('funtion updateUserData', () => {
|
||||||
|
wrapper.vm.updateUserData([111, 222, 333], [444, 555, 666])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -70,12 +70,23 @@ export default {
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
creationUserData: {
|
||||||
|
amount: null,
|
||||||
|
date: null,
|
||||||
|
memo: null,
|
||||||
|
moderator: null,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateCreationData(data) {
|
updateCreationData(data) {
|
||||||
this.creationUserData.amount = data.amount
|
this.creationUserData = data
|
||||||
this.creationUserData.date = data.date
|
// this.creationUserData.amount = data.amount
|
||||||
this.creationUserData.memo = data.memo
|
// this.creationUserData.date = data.date
|
||||||
this.creationUserData.moderator = data.moderator
|
// this.creationUserData.memo = data.memo
|
||||||
|
// this.creationUserData.moderator = data.moderator
|
||||||
data.row.toggleDetails()
|
data.row.toggleDetails()
|
||||||
},
|
},
|
||||||
updateUserData(rowItem, newCreation) {
|
updateUserData(rowItem, newCreation) {
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
"daily": "täglich",
|
"daily": "täglich",
|
||||||
"hourly": "stündlich",
|
"hourly": "stündlich",
|
||||||
"monthly": "monatlich",
|
"monthly": "monatlich",
|
||||||
"none": "kein Zyklus",
|
|
||||||
"null": "Bitter wähle einen Zyklus",
|
"null": "Bitter wähle einen Zyklus",
|
||||||
"weekly": "wöchentlich",
|
"weekly": "wöchentlich",
|
||||||
"yearly": "jährlich"
|
"yearly": "jährlich"
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
"daily": "daily",
|
"daily": "daily",
|
||||||
"hourly": "hourly",
|
"hourly": "hourly",
|
||||||
"monthly": "monthly",
|
"monthly": "monthly",
|
||||||
"none": "no cycle",
|
|
||||||
"null": "please select a cycle",
|
"null": "please select a cycle",
|
||||||
"weekly": "weekly",
|
"weekly": "weekly",
|
||||||
"yearly": "yearly"
|
"yearly": "yearly"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user