From bea0d9a49df88e382805df08c5431a5e1a0752c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski?= Date: Tue, 9 Apr 2013 00:00:02 +0200 Subject: [PATCH] Separate test/unit/wrap.js; make tests not fail when wrap module excluded --- test/index.html | 1 + test/unit/manipulation.js | 264 +------------------------------------ test/unit/wrap.js | 265 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 267 insertions(+), 263 deletions(-) create mode 100644 test/unit/wrap.js diff --git a/test/index.html b/test/index.html index 14e686034..cf9590a61 100644 --- a/test/index.html +++ b/test/index.html @@ -57,6 +57,7 @@ + diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 6093dbfb6..a15c4c5ad 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -103,234 +103,6 @@ test( "text(Function) with incoming value", function() { equal( jQuery("#sap").text(), "foobar", "Check for merged text of more then one element." ); }); -if ( jQuery.fn.wrap ) { - - var testWrap = function( val ) { - - expect( 19 ); - - var defaultText, result, j, i, cacheLength; - - defaultText = "Try them out:", - result = jQuery("#first").wrap( val("
") ).text(); - - equal( defaultText, result, "Check for wrapping of on-the-fly html" ); - ok( jQuery("#first").parent().parent().is(".red"), "Check if wrapper has class 'red'" ); - - QUnit.reset(); - result = jQuery("#first").wrap( val(document.getElementById("empty")) ).parent(); - ok( result.is("ol"), "Check for element wrapping" ); - equal( result.text(), defaultText, "Check for element wrapping" ); - - QUnit.reset(); - jQuery("#check1").on( "click", function() { - var checkbox = this; - - ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" ); - jQuery( checkbox ).wrap( val("") ); - ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" ); - }).prop( "checked", false )[ 0 ].click(); - - // using contents will get comments regular, text, and comment nodes - j = jQuery("#nonnodes").contents(); - j.wrap( val("") ); - - // Blackberry 4.6 doesn't maintain comments in the DOM - equal( jQuery("#nonnodes > i").length, jQuery("#nonnodes")[ 0 ].childNodes.length, "Check node,textnode,comment wraps ok" ); - equal( jQuery("#nonnodes > i").text(), j.text(), "Check node,textnode,comment wraps doesn't hurt text" ); - - // Try wrapping a disconnected node - cacheLength = 0; - for ( i in jQuery.cache ) { - cacheLength++; - } - - j = jQuery("