Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('can simulate a full drag and drop interaction', () => {
function TestCase() {
return
}
const WrappedTestCase = wrapInTestContext(TestCase)
// Render with the test context that uses the test backend
const root = mount()
// Obtain a reference to the backend
const backend = getBackendFromInstance(root.instance() as any)
// Find the drag source ID and use it to simulate the dragging operation
const box: DndComponent = root
.find(Box)
.at(0)
.instance() as any
const dustbin: DndComponent = root
.find(Dustbin)
.instance() as any
window.alert = jest.fn()
simulateDragDropSequence(box, dustbin, backend)
expect(window.alert).toHaveBeenCalledWith(
`You dropped ${box.props.name} into Dustbin!`,
)
})