1
0
mirror of synced 2024-11-22 21:36:04 +03:00
vue-formulario/test/FormulateInputFile.test.js

34 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-02-28 07:39:44 +03:00
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Formulate from '../src/Formulate.js'
import FileUpload from '../src/FileUpload.js'
import FormulateInput from '@/FormulateInput.vue'
import FormulateInputFile from '@/inputs/FormulateInputFile.vue'
Vue.use(Formulate)
describe('FormulateInputFile', () => {
it('type "file" renders a file element', () => {
const wrapper = mount(FormulateInput, { propsData: { type: 'file' } })
expect(wrapper.contains(FormulateInputFile)).toBe(true)
})
it('type "image" renders a file element', () => {
const wrapper = mount(FormulateInput, { propsData: { type: 'image' } })
expect(wrapper.contains(FormulateInputFile)).toBe(true)
})
/**
* ===========================================================================
* Currently there appears to be no way to properly mock upload data in
* vue-test-utils because JSDom doesn't implement DataTransfer:
*
* https://stackoverflow.com/questions/48993134/how-to-test-input-file-with-jest-and-vue-test-utils
*/
// it('type "image" renders a file element', async () => {
// })
})