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

dnd-core

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dnd-core - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

25

dist-modules/__tests__/DragDropManager-test.js

@@ -206,2 +206,27 @@ "use strict";

});
it("accurately reports handler role", function () {
var source = new NormalSource();
var sourceHandle = registry.addSource(Types.FOO, source);
var target = new NormalTarget();
var targetHandle = registry.addTarget(Types.FOO, target);
expect(registry.isSourceHandle(sourceHandle)).to.equal(true);
expect(registry.isSourceHandle(targetHandle)).to.equal(false);
expect(function () {
return registry.isSourceHandle("something else");
}).to.throwError();
expect(function () {
return registry.isSourceHandle(null);
}).to.throwError();
expect(registry.isTargetHandle(sourceHandle)).to.equal(false);
expect(registry.isTargetHandle(targetHandle)).to.equal(true);
expect(function () {
return registry.isTargetHandle("something else");
}).to.throwError();
expect(function () {
return registry.isTargetHandle(null);
}).to.throwError();
});
});

@@ -208,0 +233,0 @@

@@ -363,2 +363,4 @@ "use strict";

it("keeps track of target handles", function () {
var source = new NormalSource();
var sourceHandle = registry.addSource(Types.FOO, source);
var targetA = new NormalTarget();

@@ -378,2 +380,13 @@ var targetAHandle = registry.addTarget(Types.FOO, targetA);

expect(handles[0]).to.equal(targetAHandle);
expect(monitor.isOver(targetAHandle)).to.equal(false);
expect(monitor.isOver(targetAHandle, true)).to.equal(false);
expect(monitor.isOver(targetBHandle)).to.equal(false);
expect(monitor.isOver(targetBHandle, true)).to.equal(false);
expect(monitor.isOver(targetCHandle)).to.equal(false);
expect(monitor.isOver(targetCHandle, true)).to.equal(false);
backend.simulateBeginDrag(sourceHandle);
handles = monitor.getTargetHandles();
expect(handles.length).to.be(1);
expect(handles[0]).to.equal(targetAHandle);
expect(monitor.isOver(targetAHandle)).to.equal(true);

@@ -423,2 +436,3 @@ expect(monitor.isOver(targetAHandle, true)).to.equal(true);

backend.simulateHover([targetBHandle]);
backend.simulateDrop();
handles = monitor.getTargetHandles();

@@ -433,2 +447,12 @@ expect(handles[0]).to.equal(targetBHandle);

expect(monitor.isOver(targetCHandle, true)).to.equal(false);
backend.simulateEndDrag();
expect(handles[0]).to.equal(targetBHandle);
expect(handles.length).to.be(1);
expect(monitor.isOver(targetAHandle)).to.equal(false);
expect(monitor.isOver(targetAHandle, true)).to.equal(false);
expect(monitor.isOver(targetBHandle)).to.equal(false);
expect(monitor.isOver(targetBHandle, true)).to.equal(false);
expect(monitor.isOver(targetCHandle)).to.equal(false);
expect(monitor.isOver(targetCHandle, true)).to.equal(false);
});

@@ -435,0 +459,0 @@

4

dist-modules/DragDropMonitor.js

@@ -88,2 +88,6 @@ "use strict";

if (!this.isDragging()) {
return false;
}
var targetHandles = this.getTargetHandles();

@@ -90,0 +94,0 @@ if (!targetHandles.length) {

@@ -34,2 +34,4 @@ "use strict";

invariant(type && role && id, "Invalid handle.");
if (type.indexOf(TYPE_SEPARATOR) > -1) {

@@ -174,2 +176,18 @@ type = type.split(TYPE_SEPARATOR);

HandlerRegistry.prototype.isSourceHandle = function isSourceHandle(handle) {
var _parseHandle = parseHandle(handle);
var role = _parseHandle.role;
return role === HandlerRoles.SOURCE;
};
HandlerRegistry.prototype.isTargetHandle = function isTargetHandle(handle) {
var _parseHandle = parseHandle(handle);
var role = _parseHandle.role;
return role === HandlerRoles.TARGET;
};
HandlerRegistry.prototype.removeSource = function removeSource(sourceHandle) {

@@ -176,0 +194,0 @@ validateSourceHandle(sourceHandle);

2

package.json
{
"name": "dnd-core",
"version": "0.5.4",
"version": "0.5.5",
"description": "Drag and drop sans the GUI",

@@ -5,0 +5,0 @@ "main": "dist-modules/index.js",

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