Bug Tracker

Ticket #3820: 3820.unit.patch

File 3820.unit.patch, 1.0 KB (added by iraebrasil, 3 years ago)

Unit test proposal for this issue that the patch passes and without the path, don't

  • test/unit/event.js

     
    474474}); 
    475475 
    476476test(".live()/.die()", function() { 
    477         expect(36); 
     477        expect(38); 
    478478 
    479479        var submit = 0, div = 0, livea = 0, liveb = 0; 
    480480 
     
    588588 
    589589        // Cleanup 
    590590        jQuery("#nothiddendiv").die("foo", callback); 
     591         
     592        // Make sure we don't loose the target by DOM modifications 
     593        // after the bubble already reached the liveHandler 
     594        var livec = 0, 
     595                elemDiv = jQuery("#nothiddendivchild").html('<span></span>').get(0); 
     596         
     597        jQuery("#nothiddendivchild").live("click", function(e){ jQuery("#nothiddendivchild").html(''); }); 
     598        jQuery("#nothiddendivchild").live("click", function(e){ if(e.target) {livec++;} }); 
     599         
     600        jQuery("#nothiddendiv span").click(); 
     601        equals( jQuery("#nothiddendiv span").size(), 0, "Verify that first handler occurred and modified the DOM." ); 
     602        equals( livec, 1, "Verify that second handler occurred even with nuked target." ); 
     603         
    591604}); 
    592605 
    593606/*