UNPKG

doevisualizations

Version:

Data Visualization Library based on RequireJS and D3.js (v4+)

53 lines (40 loc) 1.16 kB
steal("jquerypp/event/drop",'syn', 'steal-qunit', function($, syn) { module("jquerypp/event/drop"); test("new drop added", 3, function(){ var div = $("<div>"+ "<div id='drag'></div>"+ "<div id='midpoint'></div>"+ "<div id='drop'></div>"+ "</div>"); div.appendTo($("#qunit-fixture")); var basicCss = { width: "20px", height: "20px", position: "absolute", border: "solid 1px black" }; $("#drag").css(basicCss).css({top: "0px", left: "0px", zIndex: 1000, backgroundColor: "red"}); $("#midpoint").css(basicCss).css({top: "0px", left: "30px"}); $("#drop").css(basicCss).css({top: "0px", left: "60px"}); $('#drag').bind("draginit", function(){}); $("#midpoint").bind("dropover",function(){ ok(true, "midpoint called"); $("#drop").bind("dropover", function(){ ok(true, "drop called"); }); $('body').on("dropon", function(ev) { ok(false, 'parent dropon should not be called'); }); $('#drop').on("dropon", function(ev) { ok(true, 'dropon called'); ev.stopPropagation(); }); $.Drop.compile(); }); stop(); syn.drag("drag",{to: "#drop"}, function(){ $('body').off('dropon'); start(); }); }); });