X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=9befade7d8c2a27c0a70af0a2a1b8498eb3f01fd;hb=75a973da35d4ad6583ebef8c389cebbef61bc5b4;hp=e7f09f62cb133de34f7327ca6e6b21d5555885b6;hpb=3e46bce751f062775be95a6bef3cf53096a3ed21;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index e7f09f6..9befade 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -909,7 +909,7 @@ test("append(String|Element|Array<Element>|jQuery)", function() { }); test("appendTo(String|Element|Array<Element>|jQuery)", function() { - expect(7); + expect(12); var defaultText = 'Try them out:' jQuery('buga').appendTo('#first'); equals( jQuery("#first").text(), defaultText + 'buga', 'Check if text appending works' ); @@ -936,6 +936,27 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() { reset(); jQuery('#select1').appendTo('#foo'); t( 'Append select', '#foo select', ['select1'] ); + + reset(); + var div = jQuery("
").click(function(){ + ok(true, "Running a cloned click."); + }); + div.appendTo("#main, #moretests"); + + jQuery("#main div:last").click(); + jQuery("#moretests div:last").click(); + + reset(); + var div = jQuery("
").appendTo("#main, #moretests"); + + equals( div.length, 2, "appendTo returns the inserted elements" ); + + div.addClass("test"); + + ok( jQuery("#main div:last").hasClass("test"), "appendTo element was modified after the insertion" ); + ok( jQuery("#moretests div:last").hasClass("test"), "appendTo element was modified after the insertion" ); + + reset(); }); test("prepend(String|Element|Array<Element>|jQuery)", function() {