1 module("Live Delegation");
3 $.each(["dropinit","dropstart","drop","dropend"],function( i, type ){
5 test('"'+ type+'"',function(){
10 ok( true, 'Not supported for this event type.');
14 // set up the delegation
15 $('.drop').live( type, function( event ){
17 equals( this, $drop[0], event.type+" target" );
21 // add a div to test the delegation
22 $drop = $('<div class="drop" />')
26 height: 100, width: 100
28 .appendTo( document.body ),
30 $drag = $('<div class="drag" />')
34 height: 100, width: 100
36 .appendTo( document.body )
39 // check triggering of the event handlers
40 ok( $drop.trigger( type ), '.trigger("'+ type +'")');
41 equals( count, 1, "event was triggered");
43 // simulate a complete drag
45 .fire("mousedown",{ pageX:50, pageY:50 })
46 .fire("mousemove",{ pageX:51, pageY:51 })
47 .fire("mouseup",{ pageX:51, pageY:51 })
48 .fire("click",{ pageX:51, pageY:51 });
50 // check the event handler counts
51 equals( count, 2, "event was delegated");
54 $('.drop').die( type );