mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-02-06 09:55:50 +00:00
Remove need for third party url upload
- we can save the file to a variable, it requires a "url" returned - we can get by returning an empty string
This commit is contained in:
parent
145f488556
commit
9f8720df81
@ -1 +1 @@
|
||||
scalar Upload
|
||||
scalar Upload
|
||||
|
||||
@ -97,10 +97,9 @@ describe('ContributionForm.vue', () => {
|
||||
})
|
||||
|
||||
describe('valid form submission', () => {
|
||||
const imageUpload = {
|
||||
file: { filename: 'avataar.svg', previewElement: '' },
|
||||
url: 'someUrlToImage',
|
||||
}
|
||||
const imageUpload = [
|
||||
{ file: { filename: 'avataar.svg', previewElement: '' }, url: 'someUrlToImage' },
|
||||
]
|
||||
beforeEach(async () => {
|
||||
expectedParams = {
|
||||
mutation: PostMutations().CreatePost,
|
||||
@ -135,8 +134,8 @@ describe('ContributionForm.vue', () => {
|
||||
})
|
||||
|
||||
it('supports adding a teaser image', async () => {
|
||||
expectedParams.variables.imageUpload = imageUpload
|
||||
wrapper.vm.vsuccess(imageUpload)
|
||||
expectedParams.variables.imageUpload = imageUpload[0]
|
||||
wrapper.vm.addTeaserImage(imageUpload)
|
||||
await wrapper.find('form').trigger('submit')
|
||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams))
|
||||
})
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
id="postdropzone"
|
||||
:use-custom-slot="true"
|
||||
@vdropzone-thumbnail="thumbnail"
|
||||
@vdropzone-success="vsuccess"
|
||||
@vdropzone-error="verror"
|
||||
>
|
||||
<div class="dz-message">
|
||||
@ -108,7 +107,7 @@ export default {
|
||||
slug: null,
|
||||
users: [],
|
||||
dropzoneOptions: {
|
||||
url: 'https://httpbin.org/post',
|
||||
url: this.addTeaserImage,
|
||||
maxFilesize: 5.0,
|
||||
previewTemplate: this.template(),
|
||||
},
|
||||
@ -204,8 +203,9 @@ export default {
|
||||
this.form.languageOptions.push({ label: locale.name, value: locale.code })
|
||||
})
|
||||
},
|
||||
vsuccess(file, response) {
|
||||
this.form.teaserImage = file
|
||||
addTeaserImage(file) {
|
||||
this.form.teaserImage = file[0]
|
||||
return ''
|
||||
},
|
||||
thumbnail: (file, dataUrl) => {
|
||||
let thumbnailElement, contributionImage, uploadArea
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user