Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-dropzone

Package Overview
Dependencies
Maintainers
2
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dropzone - npm Package Compare versions

Comparing version 4.3.0 to 5.0.0

4

dist/es/index.js

@@ -239,6 +239,6 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

if (!multiple) {
if (!multiple && acceptedFiles.length > 1) {
// if not in multi mode add any extra accepted files to rejected.
// This will allow end users to easily ignore a multi file drop in "single" mode.
rejectedFiles.push.apply(rejectedFiles, _toConsumableArray(acceptedFiles.splice(1)));
rejectedFiles.push.apply(rejectedFiles, _toConsumableArray(acceptedFiles.splice(0)));
}

@@ -245,0 +245,0 @@

@@ -126,3 +126,3 @@ {

},
"version": "4.3.0"
"version": "5.0.0"
}

@@ -199,6 +199,6 @@ /* eslint prefer-template: 0 */

if (!multiple) {
if (!multiple && acceptedFiles.length > 1) {
// if not in multi mode add any extra accepted files to rejected.
// This will allow end users to easily ignore a multi file drop in "single" mode.
rejectedFiles.push(...acceptedFiles.splice(1))
rejectedFiles.push(...acceptedFiles.splice(0))
}

@@ -205,0 +205,0 @@

@@ -625,16 +625,10 @@ import React from 'react'

it('should add valid files to rejected files on a multple drop when multiple false', async () => {
it('should reject invalid file when multiple is false', async () => {
const dropzone = mount(<Dropzone accept="image/*" onDrop={dropSpy} multiple={false} />)
await dropzone.simulate('drop', { dataTransfer: { files: images } })
const rejected = dropSpy.firstCall.args[0]
expect(rejected.length).toEqual(1)
})
it('should add invalid files to rejected when multiple is false', async () => {
const dropzone = mount(<Dropzone accept="image/*" onDrop={dropSpy} multiple={false} />)
await dropzone.simulate('drop', {
dataTransfer: { files: images.concat(files) }
dataTransfer: { files }
})
const rejected = dropSpy.firstCall.args[1]
expect(rejected.length).toEqual(2)
const [accepted, rejected] = dropSpy.firstCall.args
expect(rejected.length).toEqual(1)
expect(accepted.length).toEqual(0)
})

@@ -651,2 +645,11 @@

it('should reject multiple files to be dropped if multiple is false', async () => {
const dropzone = mount(<Dropzone accept="image/*" onDrop={dropSpy} multiple={false} />)
await dropzone.simulate('drop', { dataTransfer: { files: images } })
const [accepted, rejected] = dropSpy.firstCall.args
expect(accepted.length).toEqual(0)
expect(rejected.length).toEqual(2)
})
it('should take all dropped files if multiple is true', async () => {

@@ -653,0 +656,0 @@ const dropzone = mount(<Dropzone onDrop={dropSpy} multiple />)

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc