diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index 9dfc090f2..298f4a82f 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -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', + ) + }) }) }) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index e19fb2b9a..a24c07ec2 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -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() {