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', () => {
|
||||
it('reset enabled', () => {
|
||||
expect(
|
||||
wrapper.find('button[data-test="button-cancel"]').attributes('disabled'),
|
||||
).toBeFalsy()
|
||||
describe('reset', () => {
|
||||
it('enabled', () => {
|
||||
expect(
|
||||
wrapper.find('button[data-test="button-cancel"]').attributes('disabled'),
|
||||
).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
it('submit enabled', () => {
|
||||
expect(
|
||||
wrapper.find('button[data-test="button-submit"]').attributes('disabled'),
|
||||
).toBeFalsy()
|
||||
describe('submit', () => {
|
||||
it('enabled', () => {
|
||||
expect(
|
||||
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', () => {
|
||||
it('reset enabled', () => {
|
||||
expect(
|
||||
wrapper.find('button[data-test="button-cancel"]').attributes('disabled'),
|
||||
).toBeFalsy()
|
||||
describe('reset', () => {
|
||||
it('enabled', () => {
|
||||
expect(
|
||||
wrapper.find('button[data-test="button-cancel"]').attributes('disabled'),
|
||||
).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
it('submit enabled', () => {
|
||||
expect(
|
||||
wrapper.find('button[data-test="button-submit"]').attributes('disabled'),
|
||||
).toBeFalsy()
|
||||
describe('submit', () => {
|
||||
it('enabled', () => {
|
||||
expect(
|
||||
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: {
|
||||
submit() {
|
||||
// this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', this.form) // is 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
|
||||
// not working for testing:
|
||||
// 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()
|
||||
},
|
||||
reset() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user