diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 8b741443f..c8ae187db 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -89,10 +89,16 @@ describe('ContributionForm.vue', () => { }) describe('valid form submission', () => { - expectedParams = { - variables: { title: postTitle, content: postContent, language: 'en', id: null }, - } beforeEach(async () => { + expectedParams = { + variables: { + title: postTitle, + content: postContent, + language: 'en', + id: null, + imageUpload: null, + }, + } postTitleInput = wrapper.find('.ds-input') postTitleInput.setValue('this is a title for a post') wrapper.vm.updateEditorContent('this is a post') diff --git a/webapp/components/ContributionForm/index.vue b/webapp/components/ContributionForm/index.vue index e0aaf8c79..035e78682 100644 --- a/webapp/components/ContributionForm/index.vue +++ b/webapp/components/ContributionForm/index.vue @@ -88,7 +88,7 @@ export default { form: { title: '', content: '', - teaserImage: '', + teaserImage: null, language: null, languageOptions: [], }, @@ -123,6 +123,7 @@ export default { this.form.content = contribution.content this.form.title = contribution.title this.form.language = this.locale + this.form.teaserImage = contribution.imageUpload }, }, error() { @@ -146,16 +147,17 @@ export default { }, methods: { submit() { + const { title, content, language, teaserImage } = this.form this.loading = true this.$apollo .mutate({ mutation: this.id ? PostMutations().UpdatePost : PostMutations().CreatePost, variables: { id: this.id, - title: this.form.title, - content: this.form.content, - language: this.form.language ? this.form.language.value : this.$i18n.locale(), - imageUpload: this.form.teaserImage, + title, + content, + language: language ? language.value : this.$i18n.locale(), + imageUpload: teaserImage, }, }) .then(res => {