diff options
author | 2017-02-07 15:03:57 -0500 | |
---|---|---|
committer | 2017-02-07 15:05:15 -0500 | |
commit | 4ad39a5c96dd99acf819ce189b13fec946d7506b (patch) | |
tree | a1449286441947cc3d07a45227fa0d6f978e1a7d /ecomp-portal-FE/client/bower_components/jquery.event.drag-new/event.drop/test/live.js | |
parent | 5500448cbd1f374d0ac743ee2fd636fe2d3c0027 (diff) |
Initial OpenECOMP Portal commit
Change-Id: I804b80e0830c092e307da1599bd9fbb5c3e2da77
Signed-off-by: talasila <talasila@research.att.com>
Diffstat (limited to 'ecomp-portal-FE/client/bower_components/jquery.event.drag-new/event.drop/test/live.js')
-rw-r--r-- | ecomp-portal-FE/client/bower_components/jquery.event.drag-new/event.drop/test/live.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ecomp-portal-FE/client/bower_components/jquery.event.drag-new/event.drop/test/live.js b/ecomp-portal-FE/client/bower_components/jquery.event.drag-new/event.drop/test/live.js new file mode 100644 index 00000000..5e30130f --- /dev/null +++ b/ecomp-portal-FE/client/bower_components/jquery.event.drag-new/event.drop/test/live.js @@ -0,0 +1,60 @@ +module("Live Delegation"); + +$.each(["dropinit","dropstart","drop","dropend"],function( i, type ){ + + test('"'+ type+'"',function(){ + + expect( i ? 5 : 1 ); + + if ( !i ){ + ok( true, 'Not supported for this event type.'); + return; + } + + // set up the delegation + $('.drop').live( type, function( event ){ + count += 1; + equals( this, $drop[0], event.type+" target" ); + }); + // local refs + var count = 0, + // add a div to test the delegation + $drop = $('<div class="drop" />') + .css({ + position: 'absolute', + top: 0, left: 0, + height: 100, width: 100 + }) + .appendTo( document.body ), + // add a dragger + $drag = $('<div class="drag" />') + .css({ + position: 'absolute', + top: 0, left: 0, + height: 100, width: 100 + }) + .appendTo( document.body ) + .drag(function(){ }); + + // check triggering of the event handlers + ok( $drop.trigger( type ), '.trigger("'+ type +'")'); + equals( count, 1, "event was triggered"); + + // simulate a complete drag + $drag + .fire("mousedown",{ pageX:50, pageY:50 }) + .fire("mousemove",{ pageX:51, pageY:51 }) + .fire("mouseup",{ pageX:51, pageY:51 }) + .fire("click",{ pageX:51, pageY:51 }); + + // check the event handler counts + equals( count, 2, "event was delegated"); + + // remove delegation + $('.drop').die( type ); + $drag.remove(); + $drop.remove(); + + }); + +});
\ No newline at end of file |