diff --git a/webapp/components/Upload.vue b/webapp/components/Upload/index.vue similarity index 95% rename from webapp/components/Upload.vue rename to webapp/components/Upload/index.vue index 722cb4b8a..5a4da775d 100644 --- a/webapp/components/Upload.vue +++ b/webapp/components/Upload/index.vue @@ -5,7 +5,7 @@ ref="el" :options="dropzoneOptions" :include-styling="false" - :style="{ backgroundImage: backgroundImage(`${user.avatar}`)}" + :style="backgroundImage" @vdropzone-thumbnail="thumbnail" > @@ -35,8 +35,11 @@ export default { } }, computed: { - backgroundImage: () => avatar => { - return `url(${avatar})` + backgroundImage() { + const { avatar } = this.user || {} + return { + backgroundImage: `url(${avatar})` + } } }, methods: { diff --git a/webapp/components/Upload/spec.js b/webapp/components/Upload/spec.js new file mode 100644 index 000000000..f69211bea --- /dev/null +++ b/webapp/components/Upload/spec.js @@ -0,0 +1,16 @@ +import { shallowMount } from '@vue/test-utils' +import Upload from '.' + +describe('Upload', () => { + let wrapper + + beforeEach(() => { + wrapper = shallowMount(Upload, {}) + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + + // TODO: add more test cases in this file +})