X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=f9b68a7eacd78ab804a81317a9c34e7a66785c23;hb=6bd6a4e059f98782b19f3a6e43671a6b6be438e0;hp=316d9e4cce88a262a45371b98ced69b7d19d601f;hpb=cd28922b78a91c530c509638294fe3fac9c361f3;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 316d9e4..f9b68a7 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -615,11 +615,11 @@ test("css(String|Hash)", function() { equals( jQuery('#main').css("display"), 'none', 'Check for css property "display"'); - ok( jQuery('#foo').is(':visible'), 'Modifying CSS display: Assert element is visible'); - jQuery('#foo').css({display: 'none'}); - ok( !jQuery('#foo').is(':visible'), 'Modified CSS display: Assert element is hidden'); - jQuery('#foo').css({display: 'block'}); - ok( jQuery('#foo').is(':visible'), 'Modified CSS display: Assert element is visible'); + ok( jQuery('#nothiddendiv').is(':visible'), 'Modifying CSS display: Assert element is visible'); + jQuery('#nothiddendiv').css({display: 'none'}); + ok( !jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is hidden'); + jQuery('#nothiddendiv').css({display: 'block'}); + ok( jQuery('#nothiddendiv').is(':visible'), 'Modified CSS display: Assert element is visible'); jQuery('#floatTest').css({styleFloat: 'right'}); equals( jQuery('#floatTest').css('styleFloat'), 'right', 'Modified CSS float using "styleFloat": Assert float is right'); @@ -1156,7 +1156,7 @@ test("find(String)", function() { }); test("clone()", function() { - expect(20); + expect(28); equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Assert text for #en' ); var clone = jQuery('#yahoo').clone(); equals( 'Try them out:Yahoo', jQuery('#first').append(clone).text(), 'Check for clone' ); @@ -1176,6 +1176,31 @@ test("clone()", function() { // using contents will get comments regular, text, and comment nodes var cl = jQuery("#nonnodes").contents().clone(); ok( cl.length >= 2, "Check node,textnode,comment clone works (some browsers delete comments on clone)" ); + + var div = jQuery("
").click(function(){ + ok( true, "Bound event still exists." ); + }); + + div = div.clone(true).clone(true); + equals( div.length, 1, "One element cloned" ); + equals( div[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" ); + div.trigger("click"); + + div = jQuery("
").append([ document.createElement("table"), document.createElement("table") ]); + div.find("table").click(function(){ + ok( true, "Bound event still exists." ); + }); + + div = div.clone(true); + equals( div.length, 1, "One element cloned" ); + equals( div[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" ); + div.find("table:last").trigger("click"); + + div = jQuery("
").html(' '); + + div = div.clone(true); + equals( div.length, 1, "One element cloned" ); + equals( div[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" ); }); if (!isLocal) {