mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Write new tests in 'ContributionForm.spec.js'
This commit is contained in:
parent
f7dccb04b6
commit
9c8f76d080
@ -72,16 +72,26 @@ describe('ContributionForm', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('has button', () => {
|
describe('has button', () => {
|
||||||
it('reset enabled', () => {
|
describe('reset', () => {
|
||||||
expect(
|
it('enabled', () => {
|
||||||
wrapper.find('button[data-test="button-cancel"]').attributes('disabled'),
|
expect(
|
||||||
).toBeFalsy()
|
wrapper.find('button[data-test="button-cancel"]').attributes('disabled'),
|
||||||
|
).toBeFalsy()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('submit enabled', () => {
|
describe('submit', () => {
|
||||||
expect(
|
it('enabled', () => {
|
||||||
wrapper.find('button[data-test="button-submit"]').attributes('disabled'),
|
expect(
|
||||||
).toBeFalsy()
|
wrapper.find('button[data-test="button-submit"]').attributes('disabled'),
|
||||||
|
).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('labeled with "contribution.submit"', () => {
|
||||||
|
expect(wrapper.find('button[data-test="button-submit"]').text()).toContain(
|
||||||
|
'contribution.submit',
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -131,16 +141,26 @@ describe('ContributionForm', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('has button', () => {
|
describe('has button', () => {
|
||||||
it('reset enabled', () => {
|
describe('reset', () => {
|
||||||
expect(
|
it('enabled', () => {
|
||||||
wrapper.find('button[data-test="button-cancel"]').attributes('disabled'),
|
expect(
|
||||||
).toBeFalsy()
|
wrapper.find('button[data-test="button-cancel"]').attributes('disabled'),
|
||||||
|
).toBeFalsy()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('submit enabled', () => {
|
describe('submit', () => {
|
||||||
expect(
|
it('enabled', () => {
|
||||||
wrapper.find('button[data-test="button-submit"]').attributes('disabled'),
|
expect(
|
||||||
).toBeFalsy()
|
wrapper.find('button[data-test="button-submit"]').attributes('disabled'),
|
||||||
|
).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('labeled with "form.change"', () => {
|
||||||
|
expect(wrapper.find('button[data-test="button-submit"]').text()).toContain(
|
||||||
|
'form.change',
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -98,8 +98,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submit() {
|
submit() {
|
||||||
// this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', this.form) // is not working for testing
|
// not working for testing:
|
||||||
this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form }) // this works for testing, why ever, we have to make a spread '...', to evaluate the values it looks like
|
// this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', this.form)
|
||||||
|
// works for testing, why ever, we have to make a spread '...', to evaluate the values it looks like: (I didn't find a solution in the test itmself)
|
||||||
|
this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form })
|
||||||
this.reset()
|
this.reset()
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user