Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}}
onSubmit={onSubmit}
render={({ handleSubmit }) => (
<form>
<div>
<button aria-label="Save" type="submit">
)}
/>
);
const file1 = createFile('cats.gif', 1234, 'image/gif');
const file2 = createFile('cats2.gif', 1234, 'image/gif');
fireEvent.drop(
getByTestId('dropzone'),
createDataTransfer([file1, file2])
);
// Required because react-dropzone handle drag & drop operations asynchronously
await new Promise(resolve => setImmediate(resolve));
fireEvent.click(getByLabelText('Save'));
expect(onSubmit.mock.calls[0][0]).toEqual({
images: [
{
src: 'cats.gif',
},
{
src: 'cats2.gif',
},</button></div></form>
image: undefined,
}}
onSubmit={onSubmit}
render={({ handleSubmit }) => (
<form>
<div>
<button aria-label="Save" type="submit">
)}
/>
);
const file = createFile('cats.gif', 1234, 'image/gif');
fireEvent.drop(getByTestId('dropzone'), createDataTransfer([file]));
// Required because react-dropzone handle drag & drop operations asynchronously
await new Promise(resolve => setImmediate(resolve));
fireEvent.click(getByLabelText('Save'));
expect(onSubmit.mock.calls[0][0]).toEqual({
images: [
{
src: 'cats.gif',
},
],
});
});
</button></div></form>
fireEvent.change(htmlEl);
fireEvent.input(htmlEl);
fireEvent.invalid(htmlEl);
fireEvent.submit(htmlEl);
fireEvent.click(htmlEl);
fireEvent.contextMenu(htmlEl);
fireEvent.dblClick(htmlEl);
fireEvent.doubleClick(htmlEl);
fireEvent.drag(htmlEl);
fireEvent.dragEnd(htmlEl);
fireEvent.dragEnter(htmlEl);
fireEvent.dragExit(htmlEl);
fireEvent.dragLeave(htmlEl);
fireEvent.dragOver(htmlEl);
fireEvent.dragStart(htmlEl);
fireEvent.drop(htmlEl);
fireEvent.mouseDown(htmlEl);
fireEvent.mouseEnter(htmlEl);
fireEvent.mouseLeave(htmlEl);
fireEvent.mouseMove(htmlEl);
fireEvent.mouseOut(htmlEl);
fireEvent.mouseOver(htmlEl);
fireEvent.mouseUp(htmlEl);
fireEvent.select(htmlEl);
fireEvent.touchCancel(htmlEl);
fireEvent.touchEnd(htmlEl);
fireEvent.touchMove(htmlEl);
fireEvent.touchStart(htmlEl);
fireEvent.scroll(htmlEl);
fireEvent.wheel(htmlEl);
fireEvent.abort(htmlEl);
fireEvent.canPlay(htmlEl);
const setDragImage = jest.fn();
Object.assign(dragStartEvent, {
dataTransfer: {
setDragImage,
},
});
await fireEvent(attributeOptionMoveHandle, dragStartEvent);
await fireEvent.dragOver(attributeOptions[1], {
target: {
getBoundingClientRect: jest.fn().mockImplementation(() => {
return {bottom: 10, top: 0};
}),
clientY: 6
},
});
await fireEvent.drop(attributeOptionMoveHandle);
await fireEvent.dragEnd(attributeOptionMoveHandle);
}
const { container } = render(
wrapInIntlProvider(
wrapInRouter(
,
[
{
path: DASHBOARD_ROUTE(),
render: () => <span>dashboard</span>,
},
],
),
),
);
await screen.findByText('Create a new video');
fireEvent.drop(container.querySelector('input[type="file"]')!, {
target: {
files: [new File(['(⌐□_□)'], 'course.mp4', { type: 'video/mp4' })],
},
});
await waitFor(() =>
expect(
fetchMock.called('/api/videos/video-id/initiate-upload/', {
method: 'POST',
}),
).toBe(true),
);
await waitFor(() =>
expect(fetchMock.called('/api/videos/video-id/', { method: 'PUT' })).toBe(
true,
),
);
expect(rootProps.onFocus).not.toHaveBeenCalled()
expect(rootProps.onKeyDown).not.toHaveBeenCalled()
fireEvent.blur(dropzone)
expect(rootProps.onBlur).not.toHaveBeenCalled()
fireEvent.dragEnter(dropzone, event)
expect(rootProps.onDragEnter).not.toHaveBeenCalled()
fireEvent.dragOver(dropzone, event)
expect(rootProps.onDragOver).not.toHaveBeenCalled()
fireEvent.dragLeave(dropzone, event)
expect(rootProps.onDragLeave).not.toHaveBeenCalled()
fireEvent.drop(dropzone, event)
expect(rootProps.onDrop).not.toHaveBeenCalled()
const input = container.querySelector('input')
fireEvent.click(input)
expect(inputProps.onClick).not.toHaveBeenCalled()
fireEvent.change(input)
expect(inputProps.onChange).not.toHaveBeenCalled()
})