Skip to content

Commit

Permalink
Tweaked the live test to be a bit simpler.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Nov 30, 2009
1 parent c7407bd commit 6e5a6a2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/unit/event.js
Expand Up @@ -793,15 +793,17 @@ test(".live()/.die()", function() {


jQuery('span#liveSpan1 a').click(); jQuery('span#liveSpan1 a').click();
equals( lived, 1, "Verify that only one first handler occurred." ); equals( lived, 1, "Verify that only one first handler occurred." );
equals( livee, 0, "Verify that second handler don't." ); equals( livee, 0, "Verify that second handler doesn't." );


// and one pair in inverse // and one pair in inverse
jQuery('#liveHandlerOrder span#liveSpan2').live('click', function(){ livee++; }); jQuery('#liveHandlerOrder span#liveSpan2').live('click', function(){ livee++; });
jQuery('#liveHandlerOrder span#liveSpan2 a').live('click', function(){ lived++; return false; }); jQuery('#liveHandlerOrder span#liveSpan2 a').live('click', function(){ lived++; return false; });


lived = 0;
livee = 0;
jQuery('span#liveSpan2 a').click(); jQuery('span#liveSpan2 a').click();
equals( lived, 2, "Verify that only one first handler occurred." ); equals( lived, 1, "Verify that only one first handler occurred." );
equals( livee, 0, "Verify that second handler don't." ); equals( livee, 0, "Verify that second handler doesn't." );


// Cleanup // Cleanup
jQuery("span#liveSpan1 a, span#liveSpan1, span#liveSpan2 a, span#liveSpan2").die("click"); jQuery("span#liveSpan1 a, span#liveSpan1, span#liveSpan2 a, span#liveSpan2").die("click");
Expand Down

0 comments on commit 6e5a6a2

Please sign in to comment.