import React from 'react' import { mount, render } from 'enzyme' import { spy, stub } from 'sinon' import { onDocumentDragOver } from './utils' const Dropzone = require(process.env.JEST_TARGET ? process.env.JEST_TARGET : './index') // eslint-disable-line import/no-dynamic-require const DummyChildComponent = () => null let files let images const rejectColor = 'red' const acceptColor = 'green' const rejectStyle = { color: rejectColor, borderColor: 'black' } const acceptStyle = { color: acceptColor, borderWidth: '5px' } describe('Dropzone', () => { beforeEach(() => { files = [ { name: 'file1.pdf', size: 1111, type: 'application/pdf' } ] images = [ { name: 'cats.gif', size: 1234, type: 'image/gif' }, { name: 'dogs.jpg', size: 2345, type: 'image/jpeg' } ] }) describe('basics', () => { it('should render children', () => { const dropzone = mount(

some content

) expect(dropzone.html()).toMatchSnapshot() }) it('should render an input HTML element', () => { const dropzone = mount(

some content

) expect(dropzone.find('input').length).toEqual(1) }) it('sets ref properly', () => { const dropzone = mount() expect(dropzone.instance().fileInputEl).not.toBeUndefined() expect(dropzone.instance().fileInputEl.tagName).toEqual('INPUT') }) it('renders dynamic props on the root element', () => { const component = mount(