UNPKG

redux-form

Version:

A higher order component decorator for forms using Redux and React

27 lines (23 loc) 705 B
import expect, {createSpy} from 'expect'; import createOnDrop from '../createOnDrop'; import {dataKey} from '../createOnDragStart'; describe('createOnDrop', () => { it('should return a function', () => { expect(createOnDrop()) .toExist() .toBeA('function'); }); it('should return a function that calls change with result from getData', () => { const change = createSpy(); const getData = createSpy().andReturn('bar'); createOnDrop('foo', change)({ dataTransfer: {getData} }); expect(getData) .toHaveBeenCalled() .toHaveBeenCalledWith(dataKey); expect(change) .toHaveBeenCalled() .toHaveBeenCalledWith('foo', 'bar'); }); });