X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fmanipulation.js;h=465686fdfd7b3d06fcd9556ab862a2844591b337;hb=173c1477ae6efc4c2eeb7131ba0646c4e1323975;hp=49d717f5a42abd26e392e499114c2fea40cedf5e;hpb=bca82254137a161094377b2d8189c2d9d5906a0f;p=jquery.git diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 49d717f..465686f 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -320,7 +320,7 @@ test("prependTo(String|Element|Array<Element>|jQuery)", function() { }); var testBefore = function(val) { - expect(4); + expect(6); var expected = 'This is a normal link: bugaYahoo'; jQuery('#yahoo').before(val( 'buga' )); equals( expected, jQuery('#en').text(), 'Insert String before' ); @@ -339,6 +339,10 @@ var testBefore = function(val) { expected = "This is a normal link: diveintomarkTry them out:Yahoo"; jQuery('#yahoo').before(val( jQuery("#first, #mark") )); equals( expected, jQuery('#en').text(), "Insert jQuery before" ); + + var set = jQuery("
").before(val("test")); + equals( set[0].nodeName.toLowerCase(), "span", "Insert the element before the disconnected node." ); + equals( set.length, 2, "Insert the element before the disconnected node." ); } test("before(String|Element|Array<Element>|jQuery)", function() { @@ -372,7 +376,7 @@ test("insertBefore(String|Element|Array<Element>|jQuery)", function() { }); var testAfter = function(val) { - expect(4); + expect(6); var expected = 'This is a normal link: Yahoobuga'; jQuery('#yahoo').after(val( 'buga' )); equals( expected, jQuery('#en').text(), 'Insert String after' ); @@ -391,6 +395,10 @@ var testAfter = function(val) { expected = "This is a normal link: YahoodiveintomarkTry them out:"; jQuery('#yahoo').after(val( jQuery("#first, #mark") )); equals( expected, jQuery('#en').text(), "Insert jQuery after" ); + + var set = jQuery("
").after(val("test")); + equals( set[1].nodeName.toLowerCase(), "span", "Insert the element after the disconnected node." ); + equals( set.length, 2, "Insert the element after the disconnected node." ); }; test("after(String|Element|Array<Element>|jQuery)", function() { @@ -424,7 +432,7 @@ test("insertAfter(String|Element|Array<Element>|jQuery)", function() { }); var testReplaceWith = function(val) { - expect(10); + expect(12); jQuery('#yahoo').replaceWith(val( 'buga' )); ok( jQuery("#replace")[0], 'Replace element with string' ); ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after string' ); @@ -445,6 +453,10 @@ var testReplaceWith = function(val) { ok( jQuery("#first")[0], 'Replace element with set of elements' ); ok( jQuery("#mark")[0], 'Replace element with set of elements' ); ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after set of elements' ); + + var set = jQuery("
").replaceWith(val("test")); + equals( set[0].nodeName.toLowerCase(), "span", "Replace the disconnected node." ); + equals( set.length, 1, "Replace the disconnected node." ); } test("replaceWith(String|Element|Array<Element>|jQuery)", function() {