aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/ajax.js34
-rw-r--r--test/unit/attributes.js55
-rw-r--r--test/unit/callbacks.js292
-rw-r--r--test/unit/core.js33
-rw-r--r--test/unit/css.js12
-rw-r--r--test/unit/data.js6
-rw-r--r--test/unit/deferred.js70
-rw-r--r--test/unit/dimensions.js57
-rw-r--r--test/unit/effects.js9
-rw-r--r--test/unit/event.js11
-rw-r--r--test/unit/manipulation.js60
-rw-r--r--test/unit/support.js24
-rw-r--r--test/unit/traversing.js15
13 files changed, 281 insertions, 397 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index d13eaaeca..de680cb7d 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -857,7 +857,7 @@ test("jQuery.ajax - beforeSend", function() {
test("jQuery.ajax - beforeSend, cancel request (#2688)", function() {
expect(2);
- jQuery.ajax({
+ var request = jQuery.ajax({
url: url("data/name.html"),
beforeSend: function() {
ok( true, "beforeSend got called, canceling" );
@@ -872,14 +872,13 @@ test("jQuery.ajax - beforeSend, cancel request (#2688)", function() {
error: function() {
ok( false, "request didn't get canceled" );
}
- }).fail(function( _, reason ) {
- strictEqual( reason, "canceled", "canceled request must fail with 'canceled' status text" );
});
+ ok( request === false, "canceled request must return false instead of XMLHttpRequest instance" );
});
test("jQuery.ajax - beforeSend, cancel request manually", function() {
expect(2);
- jQuery.ajax({
+ var request = jQuery.ajax({
url: url("data/name.html"),
beforeSend: function(xhr) {
ok( true, "beforeSend got called, canceling" );
@@ -894,9 +893,8 @@ test("jQuery.ajax - beforeSend, cancel request manually", function() {
error: function() {
ok( false, "request didn't get canceled" );
}
- }).fail(function( _, reason ) {
- strictEqual( reason, "canceled", "manually canceled request must fail with 'canceled' status text" );
});
+ ok( request === false, "canceled request must return false instead of XMLHttpRequest instance" );
});
window.foobar = null;
@@ -962,16 +960,13 @@ test("serialize()", function() {
});
test("jQuery.param()", function() {
- expect(22);
+ expect(21);
equal( !jQuery.ajaxSettings.traditional, true, "traditional flag, falsy by default" );
var params = {foo:"bar", baz:42, quux:"All your base are belong to us"};
equal( jQuery.param(params), "foo=bar&baz=42&quux=All+your+base+are+belong+to+us", "simple" );
- params = {"string":"foo","null":null,"undefined":undefined};
- equal( jQuery.param(params), "string=foo&null=&undefined=", "handle nulls and undefineds properly" );
-
params = {someName: [1, 2, 3], regularThing: "blah" };
equal( jQuery.param(params), "someName%5B%5D=1&someName%5B%5D=2&someName%5B%5D=3&regularThing=blah", "with array" );
@@ -985,13 +980,13 @@ test("jQuery.param()", function() {
equal( jQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
- equal( decodeURIComponent( jQuery.param(params) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=&i[]=10&i[]=11&j=true&k=false&l[]=&l[]=0&m=cowboy+hat?", "huge structure" );
+ equal( decodeURIComponent( jQuery.param(params) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=undefined&i[]=10&i[]=11&j=true&k=false&l[]=undefined&l[]=0&m=cowboy+hat?", "huge structure" );
params = { a: [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { b: [ 7, [ 8, 9 ], [ { c: 10, d: 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { e: { f: { g: [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] };
equal( decodeURIComponent( jQuery.param(params) ), "a[]=0&a[1][]=1&a[1][]=2&a[2][]=3&a[2][1][]=4&a[2][1][]=5&a[2][2][]=6&a[3][b][]=7&a[3][b][1][]=8&a[3][b][1][]=9&a[3][b][2][0][c]=10&a[3][b][2][0][d]=11&a[3][b][3][0][]=12&a[3][b][4][0][0][]=13&a[3][b][5][e][f][g][]=14&a[3][b][5][e][f][g][1][]=15&a[3][b][]=16&a[]=17", "nested arrays" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
- equal( jQuery.param(params,true), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" );
+ equal( jQuery.param(params,true), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=undefined&l=0&m=cowboy+hat%3F", "huge structure, forced traditional" );
equal( decodeURIComponent( jQuery.param({ a: [1,2,3], "b[]": [4,5,6], "c[d]": [7,8,9], e: { f: [10], g: [11,12], h: 13 } }) ), "a[]=1&a[]=2&a[]=3&b[]=4&b[]=5&b[]=6&c[d][]=7&c[d][]=8&c[d][]=9&e[f][]=10&e[g][]=11&e[g][]=12&e[h]=13", "Make sure params are not double-encoded." );
@@ -1016,16 +1011,16 @@ test("jQuery.param()", function() {
equal( jQuery.param(params), "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", "even more arrays" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
- equal( jQuery.param(params), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=&l=0&m=cowboy+hat%3F", "huge structure" );
+ equal( jQuery.param(params), "a=1&a=2&b=%5Bobject+Object%5D&i=10&i=11&j=true&k=false&l=undefined&l=0&m=cowboy+hat%3F", "huge structure" );
params = { a: [ 0, [ 1, 2 ], [ 3, [ 4, 5 ], [ 6 ] ], { b: [ 7, [ 8, 9 ], [ { c: 10, d: 11 } ], [ [ 12 ] ], [ [ [ 13 ] ] ], { e: { f: { g: [ 14, [ 15 ] ] } } }, 16 ] }, 17 ] };
equal( jQuery.param(params), "a=0&a=1%2C2&a=3%2C4%2C5%2C6&a=%5Bobject+Object%5D&a=17", "nested arrays (not possible when jQuery.param.traditional == true)" );
params = { a:[1,2], b:{ c:3, d:[4,5], e:{ x:[6], y:7, z:[8,9] }, f:true, g:false, h:undefined }, i:[10,11], j:true, k:false, l:[undefined,0], m:"cowboy hat?" };
- equal( decodeURIComponent( jQuery.param(params,false) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=&i[]=10&i[]=11&j=true&k=false&l[]=&l[]=0&m=cowboy+hat?", "huge structure, forced not traditional" );
+ equal( decodeURIComponent( jQuery.param(params,false) ), "a[]=1&a[]=2&b[c]=3&b[d][]=4&b[d][]=5&b[e][x][]=6&b[e][y]=7&b[e][z][]=8&b[e][z][]=9&b[f]=true&b[g]=false&b[h]=undefined&i[]=10&i[]=11&j=true&k=false&l[]=undefined&l[]=0&m=cowboy+hat?", "huge structure, forced not traditional" );
params = { param1: null };
- equal( jQuery.param(params,false), "param1=", "Make sure that null params aren't traversed." );
+ equal( jQuery.param(params,false), "param1=null", "Make sure that null params aren't traversed." );
params = {"test": {"length": 3, "foo": "bar"} };
equal( jQuery.param( params, false ), "test%5Blength%5D=3&test%5Bfoo%5D=bar", "Sub-object with a length property" );
@@ -2114,14 +2109,13 @@ test( "jQuery.ajax - Context with circular references (#9887)", 2, function () {
context = {};
context.field = context;
try {
- jQuery.ajax( "non-existing", {
+ success = !jQuery.ajax( "non-existing", {
context: context,
beforeSend: function() {
ok( this === context, "context was not deep extended" );
return false;
}
});
- success = true;
} catch (e) { console.log( e ); }
ok( success, "context with circular reference did not generate an exception" );
});
@@ -2321,14 +2315,12 @@ test("jQuery.ajax - abort in prefilter", function() {
}
});
- jQuery.ajax({
+ strictEqual( jQuery.ajax({
abortInPrefilter: true,
error: function() {
ok( false, "error callback called" );
}
- }).fail(function( _, reason ) {
- strictEqual( reason, 'canceled', "Request aborted by the prefilter must fail with 'canceled' status text" );
- });
+ }), false, "Request was properly aborted early by the prefilter" );
});
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index a39712f34..dd21b6539 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -127,13 +127,18 @@ test("attr(String)", function() {
equal( $form.prop("enctype"), "multipart/form-data", "Set the enctype of a form (encoding in IE6/7 #6743)" );
});
-test("attr(String) in XML Files", function() {
- expect(3);
- var xml = createDashboardXML();
- equal( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
- equal( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
- equal( jQuery( "location", xml ).attr("checked"), "different", "Check that hooks are not attached in XML document" );
-});
+if ( !isLocal ) {
+ test("attr(String) in XML Files", function() {
+ expect(3);
+ stop();
+ jQuery.get("data/dashboard.xml", function( xml ) {
+ equal( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
+ equal( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
+ equal( jQuery( "location", xml ).attr("checked"), "different", "Check that hooks are not attached in XML document" );
+ start();
+ });
+ });
+}
test("attr(String, Function)", function() {
expect(2);
@@ -387,16 +392,21 @@ test("attr(jquery_method)", function(){
equal( elem.style.paddingRight, "1px", "attr({...})");
});
-test("attr(String, Object) - Loaded via XML document", function() {
- expect(2);
- var xml = createDashboardXML();
- var titles = [];
- jQuery( "tab", xml ).each(function() {
- titles.push( jQuery(this).attr("title") );
+if ( !isLocal ) {
+ test("attr(String, Object) - Loaded via XML document", function() {
+ expect(2);
+ stop();
+ jQuery.get("data/dashboard.xml", function( xml ) {
+ var titles = [];
+ jQuery( "tab", xml ).each(function() {
+ titles.push( jQuery(this).attr("title") );
+ });
+ equal( titles[0], "Location", "attr() in XML context: Check first title" );
+ equal( titles[1], "Users", "attr() in XML context: Check second title" );
+ start();
+ });
});
- equal( titles[0], "Location", "attr() in XML context: Check first title" );
- equal( titles[1], "Users", "attr() in XML context: Check second title" );
-});
+}
test("attr('tabindex')", function() {
expect(8);
@@ -1182,16 +1192,3 @@ test("coords returns correct values in IE6/IE7, see #10828", function() {
area = map.html("<area shape='rect' href='#' alt='a' /></map>").find("area");
equal( area.attr("coords"), undefined, "did not retrieve coords correctly");
});
-
-test("Handle cased attributes on XML DOM correctly in removeAttr()", function() {
- expect(1);
-
- var xmlStr = "<root><item fooBar='123' /></root>",
- $xmlDoc = jQuery( jQuery.parseXML( xmlStr ) ),
- $item = $xmlDoc.find( "item" ),
- el = $item[0];
-
- $item.removeAttr( "fooBar" );
-
- equal( el.attributes.length, 0, "attribute with upper case did not get removed" );
-});
diff --git a/test/unit/callbacks.js b/test/unit/callbacks.js
index acc61f32c..acc88f2c2 100644
--- a/test/unit/callbacks.js
+++ b/test/unit/callbacks.js
@@ -33,171 +33,149 @@ var output,
}
};
- function showFlags( flags ) {
- if ( typeof flags === "string" ) {
- return '"' + flags + '"';
- }
- var output = [], key;
- for ( key in flags ) {
- output.push( '"' + key + '": ' + flags[ key ] );
- }
- return "{ " + output.join( ", " ) + " }";
- }
+jQuery.each( tests, function( flags, resultString ) {
-jQuery.each( tests, function( strFlags, resultString ) {
+ jQuery.each( filters, function( filterLabel, filter ) {
- var objectFlags = {};
+ test( "jQuery.Callbacks( \"" + flags + "\" ) - " + filterLabel, function() {
- jQuery.each( strFlags.split( " " ), function() {
- if ( this.length ) {
- objectFlags[ this ] = true;
- }
- });
+ expect( 20 );
- jQuery.each( filters, function( filterLabel, filter ) {
+ // Give qunit a little breathing room
+ stop();
+ setTimeout( start, 0 );
+
+ var cblist;
+ results = resultString.split( /\s+/ );
- jQuery.each( { "string": strFlags, "object": objectFlags }, function( flagsTypes, flags ) {
-
- test( "jQuery.Callbacks( " + showFlags( flags ) + " ) - " + filterLabel, function() {
-
- expect( 20 );
-
- // Give qunit a little breathing room
- stop();
- setTimeout( start, 0 );
-
- var cblist;
- results = resultString.split( /\s+/ );
-
- // Basic binding and firing
- output = "X";
- cblist = jQuery.Callbacks( flags );
- cblist.add(function( str ) {
- output += str;
- });
- cblist.fire( "A" );
- strictEqual( output, "XA", "Basic binding and firing" );
- strictEqual( cblist.fired(), true, ".fired() detects firing" );
- output = "X";
- cblist.disable();
- cblist.add(function( str ) {
- output += str;
- });
- strictEqual( output, "X", "Adding a callback after disabling" );
- cblist.fire( "A" );
- strictEqual( output, "X", "Firing after disabling" );
-
- // Basic binding and firing (context, arguments)
- output = "X";
- cblist = jQuery.Callbacks( flags );
- cblist.add(function() {
- equal( this, window, "Basic binding and firing (context)" );
- output += Array.prototype.join.call( arguments, "" );
- });
- cblist.fireWith( window, [ "A", "B" ] );
- strictEqual( output, "XAB", "Basic binding and firing (arguments)" );
-
- // fireWith with no arguments
- output = "";
- cblist = jQuery.Callbacks( flags );
- cblist.add(function() {
- equal( this, window, "fireWith with no arguments (context is window)" );
- strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" );
- });
- cblist.fireWith();
-
- // Basic binding, removing and firing
- output = "X";
- cblist = jQuery.Callbacks( flags );
- cblist.add( outputA, outputB, outputC );
- cblist.remove( outputB, outputC );
- cblist.fire();
- strictEqual( output, "XA", "Basic binding, removing and firing" );
-
- // Empty
- output = "X";
- cblist = jQuery.Callbacks( flags );
- cblist.add( outputA );
- cblist.add( outputB );
+ // Basic binding and firing
+ output = "X";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add(function( str ) {
+ output += str;
+ });
+ cblist.fire( "A" );
+ strictEqual( output, "XA", "Basic binding and firing" );
+ strictEqual( cblist.fired(), true, ".fired() detects firing" );
+ output = "X";
+ cblist.disable();
+ cblist.add(function( str ) {
+ output += str;
+ });
+ strictEqual( output, "X", "Adding a callback after disabling" );
+ cblist.fire( "A" );
+ strictEqual( output, "X", "Firing after disabling" );
+
+ // Basic binding and firing (context, arguments)
+ output = "X";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add(function() {
+ equal( this, window, "Basic binding and firing (context)" );
+ output += Array.prototype.join.call( arguments, "" );
+ });
+ cblist.fireWith( window, [ "A", "B" ] );
+ strictEqual( output, "XAB", "Basic binding and firing (arguments)" );
+
+ // fireWith with no arguments
+ output = "";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add(function() {
+ equal( this, window, "fireWith with no arguments (context is window)" );
+ strictEqual( arguments.length, 0, "fireWith with no arguments (no arguments)" );
+ });
+ cblist.fireWith();
+
+ // Basic binding, removing and firing
+ output = "X";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add( outputA, outputB, outputC );
+ cblist.remove( outputB, outputC );
+ cblist.fire();
+ strictEqual( output, "XA", "Basic binding, removing and firing" );
+
+ // Empty
+ output = "X";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add( outputA );
+ cblist.add( outputB );
+ cblist.add( outputC );
+ cblist.empty();
+ cblist.fire();
+ strictEqual( output, "X", "Empty" );
+
+ // Locking
+ output = "X";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add( function( str ) {
+ output += str;
+ });
+ cblist.lock();
+ cblist.add( function( str ) {
+ output += str;
+ });
+ cblist.fire( "A" );
+ cblist.add( function( str ) {
+ output += str;
+ });
+ strictEqual( output, "X", "Lock early" );
+
+ // Ordering
+ output = "X";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add( function() {
cblist.add( outputC );
- cblist.empty();
- cblist.fire();
- strictEqual( output, "X", "Empty" );
-
- // Locking
- output = "X";
- cblist = jQuery.Callbacks( flags );
- cblist.add( function( str ) {
- output += str;
- });
- cblist.lock();
- cblist.add( function( str ) {
- output += str;
- });
- cblist.fire( "A" );
- cblist.add( function( str ) {
- output += str;
- });
- strictEqual( output, "X", "Lock early" );
-
- // Ordering
- output = "X";
- cblist = jQuery.Callbacks( flags );
- cblist.add( function() {
- cblist.add( outputC );
- outputA();
- }, outputB );
- cblist.fire();
- strictEqual( output, results.shift(), "Proper ordering" );
-
- // Add and fire again
- output = "X";
- cblist.add( function() {
- cblist.add( outputC );
- outputA();
- }, outputB );
- strictEqual( output, results.shift(), "Add after fire" );
-
- output = "X";
- cblist.fire();
- strictEqual( output, results.shift(), "Fire again" );
-
- // Multiple fire
- output = "X";
- cblist = jQuery.Callbacks( flags );
- cblist.add( function( str ) {
- output += str;
- } );
- cblist.fire( "A" );
- strictEqual( output, "XA", "Multiple fire (first fire)" );
- output = "X";
- cblist.add( function( str ) {
- output += str;
- } );
- strictEqual( output, results.shift(), "Multiple fire (first new callback)" );
- output = "X";
- cblist.fire( "B" );
- strictEqual( output, results.shift(), "Multiple fire (second fire)" );
- output = "X";
- cblist.add( function( str ) {
- output += str;
- } );
- strictEqual( output, results.shift(), "Multiple fire (second new callback)" );
-
- // Return false
- output = "X";
- cblist = jQuery.Callbacks( flags );
- cblist.add( outputA, function() { return false; }, outputB );
- cblist.add( outputA );
- cblist.fire();
- strictEqual( output, results.shift(), "Callback returning false" );
-
- // Add another callback (to control lists with memory do not fire anymore)
- output = "X";
+ outputA();
+ }, outputB );
+ cblist.fire();
+ strictEqual( output, results.shift(), "Proper ordering" );
+
+ // Add and fire again
+ output = "X";
+ cblist.add( function() {
cblist.add( outputC );
- strictEqual( output, results.shift(), "Adding a callback after one returned false" );
+ outputA();
+ }, outputB );
+ strictEqual( output, results.shift(), "Add after fire" );
+
+ output = "X";
+ cblist.fire();
+ strictEqual( output, results.shift(), "Fire again" );
+
+ // Multiple fire
+ output = "X";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add( function( str ) {
+ output += str;
+ } );
+ cblist.fire( "A" );
+ strictEqual( output, "XA", "Multiple fire (first fire)" );
+ output = "X";
+ cblist.add( function( str ) {
+ output += str;
+ } );
+ strictEqual( output, results.shift(), "Multiple fire (first new callback)" );
+ output = "X";
+ cblist.fire( "B" );
+ strictEqual( output, results.shift(), "Multiple fire (second fire)" );
+ output = "X";
+ cblist.add( function( str ) {
+ output += str;
+ } );
+ strictEqual( output, results.shift(), "Multiple fire (second new callback)" );
+
+ // Return false
+ output = "X";
+ cblist = jQuery.Callbacks( flags );
+ cblist.add( outputA, function() { return false; }, outputB );
+ cblist.add( outputA );
+ cblist.fire();
+ strictEqual( output, results.shift(), "Callback returning false" );
+
+ // Add another callback (to control lists with memory do not fire anymore)
+ output = "X";
+ cblist.add( outputC );
+ strictEqual( output, results.shift(), "Adding a callback after one returned false" );
- });
});
});
});
diff --git a/test/unit/core.js b/test/unit/core.js
index 94f985db6..e87c10664 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -547,16 +547,21 @@ test("XSS via location.hash", function() {
jQuery( '#<img id="check9521" src="no-such-.gif" onerror="jQuery._check9521(false)">' ).appendTo("#qunit-fixture");
} catch (err) {
jQuery._check9521(true);
- }
+ };
});
+if ( !isLocal ) {
test("isXMLDoc - XML", function() {
expect(3);
- var xml = createDashboardXML();
- ok( jQuery.isXMLDoc( xml ), "XML document" );
- ok( jQuery.isXMLDoc( xml.documentElement ), "XML documentElement" );
- ok( jQuery.isXMLDoc( jQuery("tab", xml)[0] ), "XML Tab Element" );
+ stop();
+ jQuery.get("data/dashboard.xml", function(xml) {
+ ok( jQuery.isXMLDoc( xml ), "XML document" );
+ ok( jQuery.isXMLDoc( xml.documentElement ), "XML documentElement" );
+ ok( jQuery.isXMLDoc( jQuery("tab", xml)[0] ), "XML Tab Element" );
+ start();
+ });
});
+}
test("isWindow", function() {
expect( 14 );
@@ -633,16 +638,20 @@ test("jQuery('html', context)", function() {
equal($span.length, 1, "Verify a span created with a div context works, #1763");
});
+if ( !isLocal ) {
test("jQuery(selector, xml).text(str) - Loaded via XML document", function() {
expect(2);
-
- var xml = createDashboardXML();
- // tests for #1419 where IE was a problem
- var tab = jQuery("tab", xml).eq(0);
- equal( tab.text(), "blabla", "Verify initial text correct" );
- tab.text("newtext");
- equal( tab.text(), "newtext", "Verify new text correct" );
+ stop();
+ jQuery.get("data/dashboard.xml", function(xml) {
+ // tests for #1419 where IE was a problem
+ var tab = jQuery("tab", xml).eq(0);
+ equal( tab.text(), "blabla", "Verify initial text correct" );
+ tab.text("newtext");
+ equal( tab.text(), "newtext", "Verify new text correct" );
+ start();
+ });
});
+}
test("end()", function() {
expect(3);
diff --git a/test/unit/css.js b/test/unit/css.js
index 6d0b39f81..8e7f8ec10 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -555,18 +555,6 @@ test("outerWidth(true) and css('margin') returning % instead of px in Webkit, se
equal( el.outerWidth(true), 400, "outerWidth(true) and css('margin') returning % instead of px in Webkit, see #10639" );
});
-test("css('width') should respect box-sizing, see #11004", function() {
- var el_disconnected = jQuery("<div style='width:300px;margin:2px;padding:2px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;'>test</div>"),
- el = el_disconnected.clone().appendTo("#qunit-fixture"),
- width_initial = el.css("width"),
- width_roundtrip = el.css("width", el.css("width")).css("width"),
- width_initial_disconnected = el_disconnected.css("width"),
- width_roundtrip_disconnected = el_disconnected.css("width", el_disconnected.css("width")).css("width");
-
- equal( width_roundtrip, width_initial, "css('width') is not respecting box-sizing, see #11004");
- equal( width_roundtrip_disconnected, width_initial_disconnected, "css('width') is not respecting box-sizing for disconnected element, see #11004");
-});
-
test( "cssHooks - expand", function() {
expect( 15 );
var result,
diff --git a/test/unit/data.js b/test/unit/data.js
index 89869f795..7598ba8be 100644
--- a/test/unit/data.js
+++ b/test/unit/data.js
@@ -184,6 +184,9 @@ test(".data()", function() {
var dataObj = div.data();
+ // TODO: Remove this hack which was introduced in 1.5.1
+ delete dataObj.toJSON;
+
deepEqual( dataObj, {test: "success"}, "data() get the entire data object" );
strictEqual( div.data("foo"), undefined, "Make sure that missing result is still undefined" );
@@ -195,6 +198,9 @@ test(".data()", function() {
dataObj = jQuery.extend(true, {}, jQuery(obj).data());
+ // TODO: Remove this hack which was introduced for 1.5.1
+ delete dataObj.toJSON;
+
deepEqual( dataObj, { foo: "baz" }, "Retrieve data object from a wrapped JS object (#7524)" );
});
diff --git a/test/unit/deferred.js b/test/unit/deferred.js
index 7ff274d56..4a50da2c1 100644
--- a/test/unit/deferred.js
+++ b/test/unit/deferred.js
@@ -8,36 +8,32 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
test("jQuery.Deferred" + withNew, function() {
- expect( 23 );
+ expect( 22 );
- var defer = createDeferred();
-
- strictEqual( defer.pipe, defer.then, "pipe is an alias of then" );
-
- createDeferred().resolve().done(function() {
+ createDeferred().resolve().then( function() {
ok( true , "Success on resolve" );
ok( this.isResolved(), "Deferred is resolved" );
strictEqual( this.state(), "resolved", "Deferred is resolved (state)" );
- }).fail(function() {
+ }, function() {
ok( false , "Error on resolve" );
- }).always(function() {
+ }).always( function() {
ok( true , "Always callback on resolve" );
});
- createDeferred().reject().done(function() {
+ createDeferred().reject().then( function() {
ok( false , "Success on reject" );
- }).fail(function() {
+ }, function() {
ok( true , "Error on reject" );
ok( this.isRejected(), "Deferred is rejected" );
strictEqual( this.state(), "rejected", "Deferred is rejected (state)" );
- }).always(function() {
+ }).always( function() {
ok( true , "Always callback on reject" );
});
- createDeferred(function( defer ) {
+ createDeferred( function( defer ) {
ok( this === defer , "Defer passed as this & first argument" );
this.resolve( "done" );
- }).done( function( value ) {
+ }).then( function( value ) {
strictEqual( value , "done" , "Passed function executed" );
});
@@ -62,7 +58,7 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
test( "jQuery.Deferred - chainability", function() {
- var methods = "resolve reject notify resolveWith rejectWith notifyWith done fail progress always".split( " " ),
+ var methods = "resolve reject notify resolveWith rejectWith notifyWith done fail progress then always".split( " " ),
defer = jQuery.Deferred();
expect( methods.length );
@@ -73,12 +69,12 @@ test( "jQuery.Deferred - chainability", function() {
});
});
-test( "jQuery.Deferred.then - filtering (done)", function() {
+test( "jQuery.Deferred.pipe - filtering (done)", function() {
expect(4);
var defer = jQuery.Deferred(),
- piped = defer.then(function( a, b ) {
+ piped = defer.pipe(function( a, b ) {
return a * b;
}),
value1,
@@ -100,21 +96,21 @@ test( "jQuery.Deferred.then - filtering (done)", function() {
strictEqual( value2, 3, "second resolve value ok" );
strictEqual( value3, 6, "result of filter ok" );
- jQuery.Deferred().reject().then(function() {
- ok( false, "then should not be called on reject" );
+ jQuery.Deferred().reject().pipe(function() {
+ ok( false, "pipe should not be called on reject" );
});
- jQuery.Deferred().resolve().then( jQuery.noop ).done(function( value ) {
- strictEqual( value, undefined, "then done callback can return undefined/null" );
+ jQuery.Deferred().resolve().pipe( jQuery.noop ).done(function( value ) {
+ strictEqual( value, undefined, "pipe done callback can return undefined/null" );
});
});
-test( "jQuery.Deferred.then - filtering (fail)", function() {
+test( "jQuery.Deferred.pipe - filtering (fail)", function() {
expect(4);
var defer = jQuery.Deferred(),
- piped = defer.then( null, function( a, b ) {
+ piped = defer.pipe( null, function( a, b ) {
return a * b;
} ),
value1,
@@ -136,21 +132,21 @@ test( "jQuery.Deferred.then - filtering (fail)", function() {
strictEqual( value2, 3, "second reject value ok" );
strictEqual( value3, 6, "result of filter ok" );
- jQuery.Deferred().resolve().then( null, function() {
- ok( false, "then should not be called on resolve" );
+ jQuery.Deferred().resolve().pipe( null, function() {
+ ok( false, "pipe should not be called on resolve" );
} );
- jQuery.Deferred().reject().then( null, jQuery.noop ).fail(function( value ) {
- strictEqual( value, undefined, "then fail callback can return undefined/null" );
+ jQuery.Deferred().reject().pipe( null, jQuery.noop ).fail(function( value ) {
+ strictEqual( value, undefined, "pipe fail callback can return undefined/null" );
});
});
-test( "jQuery.Deferred.then - filtering (progress)", function() {
+test( "jQuery.Deferred.pipe - filtering (progress)", function() {
expect(3);
var defer = jQuery.Deferred(),
- piped = defer.then( null, null, function( a, b ) {
+ piped = defer.pipe( null, null, function( a, b ) {
return a * b;
} ),
value1,
@@ -173,12 +169,12 @@ test( "jQuery.Deferred.then - filtering (progress)", function() {
strictEqual( value3, 6, "result of filter ok" );
});
-test( "jQuery.Deferred.then - deferred (done)", function() {
+test( "jQuery.Deferred.pipe - deferred (done)", function() {
expect(3);
var defer = jQuery.Deferred(),
- piped = defer.then(function( a, b ) {
+ piped = defer.pipe(function( a, b ) {
return jQuery.Deferred(function( defer ) {
defer.reject( a * b );
});
@@ -203,12 +199,12 @@ test( "jQuery.Deferred.then - deferred (done)", function() {
strictEqual( value3, 6, "result of filter ok" );
});
-test( "jQuery.Deferred.then - deferred (fail)", function() {
+test( "jQuery.Deferred.pipe - deferred (fail)", function() {
expect(3);
var defer = jQuery.Deferred(),
- piped = defer.then( null, function( a, b ) {
+ piped = defer.pipe( null, function( a, b ) {
return jQuery.Deferred(function( defer ) {
defer.resolve( a * b );
});
@@ -233,12 +229,12 @@ test( "jQuery.Deferred.then - deferred (fail)", function() {
strictEqual( value3, 6, "result of filter ok" );
});
-test( "jQuery.Deferred.then - deferred (progress)", function() {
+test( "jQuery.Deferred.pipe - deferred (progress)", function() {
expect(3);
var defer = jQuery.Deferred(),
- piped = defer.then( null, null, function( a, b ) {
+ piped = defer.pipe( null, null, function( a, b ) {
return jQuery.Deferred(function( defer ) {
defer.resolve( a * b );
});
@@ -263,13 +259,13 @@ test( "jQuery.Deferred.then - deferred (progress)", function() {
strictEqual( value3, 6, "result of filter ok" );
});
-test( "jQuery.Deferred.then - context", function() {
+test( "jQuery.Deferred.pipe - context", function() {
expect(4);
var context = {};
- jQuery.Deferred().resolveWith( context, [ 2 ] ).then(function( value ) {
+ jQuery.Deferred().resolveWith( context, [ 2 ] ).pipe(function( value ) {
return value * 3;
}).done(function( value ) {
strictEqual( this, context, "custom context correctly propagated" );
@@ -277,7 +273,7 @@ test( "jQuery.Deferred.then - context", function() {
});
var defer = jQuery.Deferred(),
- piped = defer.then(function( value ) {
+ piped = defer.pipe(function( value ) {
return value * 3;
});
diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js
index ef3d8ca68..c6b8e835c 100644
--- a/test/unit/dimensions.js
+++ b/test/unit/dimensions.js
@@ -230,13 +230,12 @@ test("outerWidth()", function() {
jQuery.removeData($div[0], "olddisplay", true);
});
-test("child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #9441 #9300", function() {
- expect(16);
+test("child of a hidden elem has accurate inner/outer/Width()/Height() see #9441 #9300", function() {
+ expect(8);
// setup html
- var $divNormal = jQuery("<div>").css({ width: "100px", height: "100px", border: "10px solid white", padding: "2px", margin: "3px" }),
- $divChild = $divNormal.clone(),
- $divUnconnected = $divNormal.clone(),
+ var $divNormal = jQuery("<div>").css({ width: "100px", height: "100px", border: "10px solid white", padding: "2px", margin: "3px" }),
+ $divChild = $divNormal.clone(),
$divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body");
$divNormal.appendTo("body");
@@ -251,17 +250,6 @@ test("child of a hidden elem (or unconnected node) has accurate inner/outer/Widt
equal( $divChild.outerHeight(), $divNormal.outerHeight(), "child of a hidden element outerHeight() is wrong see #9441" );
equal( $divChild.outerHeight(true), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #9300" );
- // tests that child div of an unconnected div works the same as a normal div
- equal( $divUnconnected.width(), $divNormal.width(), "unconnected element width() is wrong see #9441" );
- equal( $divUnconnected.innerWidth(), $divNormal.innerWidth(), "unconnected element innerWidth() is wrong see #9441" );
- equal( $divUnconnected.outerWidth(), $divNormal.outerWidth(), "unconnected element outerWidth() is wrong see #9441" );
- equal( $divUnconnected.outerWidth(true), $divNormal.outerWidth( true ), "unconnected element outerWidth( true ) is wrong see #9300" );
-
- equal( $divUnconnected.height(), $divNormal.height(), "unconnected element height() is wrong see #9441" );
- equal( $divUnconnected.innerHeight(), $divNormal.innerHeight(), "unconnected element innerHeight() is wrong see #9441" );
- equal( $divUnconnected.outerHeight(), $divNormal.outerHeight(), "unconnected element outerHeight() is wrong see #9441" );
- equal( $divUnconnected.outerHeight(true), $divNormal.outerHeight( true ), "unconnected element outerHeight( true ) is wrong see #9300" );
-
// teardown html
$divHiddenParent.remove();
$divNormal.remove();
@@ -290,43 +278,6 @@ test("getting dimensions shouldnt modify runtimeStyle see #9233", function() {
$div.remove();
});
-test("box-sizing:border-box child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #10413", function() {
- expect(16);
-
- // setup html
- var $divNormal = jQuery("<div>").css({ boxSizing: "border-box", width: "100px", height: "100px", border: "10px solid white", padding: "2px", margin: "3px" }),
- $divChild = $divNormal.clone(),
- $divUnconnected = $divNormal.clone(),
- $divHiddenParent = jQuery("<div>").css( "display", "none" ).append( $divChild ).appendTo("body");
- $divNormal.appendTo("body");
-
- // tests that child div of a hidden div works the same as a normal div
- equal( $divChild.width(), $divNormal.width(), "child of a hidden element width() is wrong see #10413" );
- equal( $divChild.innerWidth(), $divNormal.innerWidth(), "child of a hidden element innerWidth() is wrong see #10413" );
- equal( $divChild.outerWidth(), $divNormal.outerWidth(), "child of a hidden element outerWidth() is wrong see #10413" );
- equal( $divChild.outerWidth(true), $divNormal.outerWidth( true ), "child of a hidden element outerWidth( true ) is wrong see #10413" );
-
- equal( $divChild.height(), $divNormal.height(), "child of a hidden element height() is wrong see #10413" );
- equal( $divChild.innerHeight(), $divNormal.innerHeight(), "child of a hidden element innerHeight() is wrong see #10413" );
- equal( $divChild.outerHeight(), $divNormal.outerHeight(), "child of a hidden element outerHeight() is wrong see #10413" );
- equal( $divChild.outerHeight(true), $divNormal.outerHeight( true ), "child of a hidden element outerHeight( true ) is wrong see #10413" );
-
- // tests that child div of an unconnected div works the same as a normal div
- equal( $divUnconnected.width(), $divNormal.width(), "unconnected element width() is wrong see #10413" );
- equal( $divUnconnected.innerWidth(), $divNormal.innerWidth(), "unconnected element innerWidth() is wrong see #10413" );
- equal( $divUnconnected.outerWidth(), $divNormal.outerWidth(), "unconnected element outerWidth() is wrong see #10413" );
- equal( $divUnconnected.outerWidth(true), $divNormal.outerWidth( true ), "unconnected element outerWidth( true ) is wrong see #10413" );
-
- equal( $divUnconnected.height(), $divNormal.height(), "unconnected element height() is wrong see #10413" );
- equal( $divUnconnected.innerHeight(), $divNormal.innerHeight(), "unconnected element innerHeight() is wrong see #10413" );
- equal( $divUnconnected.outerHeight(), $divNormal.outerHeight(), "unconnected element outerHeight() is wrong see #10413" );
- equal( $divUnconnected.outerHeight(true), $divNormal.outerHeight( true ), "unconnected element outerHeight( true ) is wrong see #10413" );
-
- // teardown html
- $divHiddenParent.remove();
- $divNormal.remove();
-});
-
test("outerHeight()", function() {
expect(11);
diff --git a/test/unit/effects.js b/test/unit/effects.js
index 25c9834e4..e478cdf63 100644
--- a/test/unit/effects.js
+++ b/test/unit/effects.js
@@ -263,15 +263,6 @@ test("animate negative height", function() {
});
});
-test("animate negative margin", function() {
- expect(1);
- stop();
- jQuery("#foo").animate({ marginTop: -100 }, 100, function() {
- equal( jQuery(this).css("marginTop"), "-100px", "Verify margin." );
- start();
- });
-});
-
test("animate negative padding", function() {
expect(1);
stop();
diff --git a/test/unit/event.js b/test/unit/event.js
index 172f3a82a..3c9a08109 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -2867,15 +2867,4 @@ test("fixHooks extensions", function() {
})();
-asyncTest("trigger click on checkbox, fires change event", function() {
- expect(1);
-
- var check = jQuery("#check2");
- check.on( "change", function() {
- // get it?
- check.off("change");
- ok( true, "Change event fired as a result of triggered click" );
- start();
- }).trigger("click");
-});
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index 672b204e1..ff31c4db4 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -555,28 +555,6 @@ test("html(String) with HTML5 (Bug #6485)", function() {
equal( jQuery("#qunit-fixture").children().children().children().length, 1, "Make sure nested HTML5 elements can hold children." );
});
-
-
-test("IE8 serialization bug", function () {
- expect(2);
- var wrapper = jQuery("<div></div>");
-
- wrapper.html("<div></div><article></article>");
- equal( wrapper.children("article").length, 1, "HTML5 elements are insertable with .html()");
-
- wrapper.html("<div></div><link></link>");
- equal( wrapper.children("link").length, 1, "Link elements are insertable with .html()");
-});
-
-test("html() object element #10324", function() {
- expect( 1 );
-
- var object = jQuery("<object id='object2'><param name='object2test' value='test'></param></object>?").appendTo("#qunit-fixture"),
- clone = object.clone();
-
- equal( clone.html(), object.html(), "html() returns correct innerhtml of cloned object elements" );
-});
-
test("append(xml)", function() {
expect( 1 );
@@ -924,7 +902,7 @@ test("insertAfter(String|Element|Array&lt;Element&gt;|jQuery)", function() {
});
var testReplaceWith = function(val) {
- expect(22);
+ expect(21);
jQuery("#yahoo").replaceWith(val( "<b id='replace'>buga</b>" ));
ok( jQuery("#replace")[0], "Replace element with string" );
ok( !jQuery("#yahoo")[0], "Verify that original element is gone, after string" );
@@ -985,9 +963,6 @@ var testReplaceWith = function(val) {
equal( set[0].nodeName.toLowerCase(), "span", "Replace the disconnected node." );
equal( set.length, 1, "Replace the disconnected node." );
- // #11338
- ok( jQuery("<div>1</div>").replaceWith( val("<span/>") ).is("span"), "#11338, Make sure disconnected node with content is replaced");
-
var non_existant = jQuery("#does-not-exist").replaceWith( val("<b>should not throw an error</b>") );
equal( non_existant.length, 0, "Length of non existant element." );
@@ -1018,7 +993,7 @@ test("replaceWith(String|Element|Array&lt;Element&gt;|jQuery)", function() {
test("replaceWith(Function)", function() {
testReplaceWith(functionReturningObj);
- expect(23);
+ expect(22);
var y = jQuery("#yahoo")[0];
@@ -1245,17 +1220,22 @@ test("clone(multiple selected options) (Bug #8129)", function() {
});
+if (!isLocal) {
test("clone() on XML nodes", function() {
expect(2);
- var xml = createDashboardXML();
- var root = jQuery(xml.documentElement).clone();
- var origTab = jQuery("tab", xml).eq(0);
- var cloneTab = jQuery("tab", root).eq(0);
- origTab.text("origval");
- cloneTab.text("cloneval");
- equal(origTab.text(), "origval", "Check original XML node was correctly set");
- equal(cloneTab.text(), "cloneval", "Check cloned XML node was correctly set");
+ stop();
+ jQuery.get("data/dashboard.xml", function (xml) {
+ var root = jQuery(xml.documentElement).clone();
+ var origTab = jQuery("tab", xml).eq(0);
+ var cloneTab = jQuery("tab", root).eq(0);
+ origTab.text("origval");
+ cloneTab.text("cloneval");
+ equal(origTab.text(), "origval", "Check original XML node was correctly set");
+ equal(cloneTab.text(), "cloneval", "Check cloned XML node was correctly set");
+ start();
+ });
});
+}
test("clone() on local XML nodes with html5 nodename", function() {
expect(2);
@@ -1775,12 +1755,4 @@ test("Guard against exceptions when clearing safeChildNodes", function() {
} catch(e) {}
ok( div && div.jquery, "Created nodes safely, guarded against exceptions on safeChildNodes[ -1 ]" );
-});
-
-test("Ensure oldIE creates a new set on appendTo (#8894)", function() {
- strictEqual( jQuery("<div/>").clone().addClass("test").appendTo("<div/>").end().hasClass("test"), false, "Check jQuery.fn.appendTo after jQuery.clone" );
- strictEqual( jQuery("<div/>").find("p").end().addClass("test").appendTo("<div/>").end().hasClass("test"), false, "Check jQuery.fn.appendTo after jQuery.fn.find" );
- strictEqual( jQuery("<div/>").text("test").addClass("test").appendTo("<div/>").end().hasClass("test"), false, "Check jQuery.fn.appendTo after jQuery.fn.text" );
- strictEqual( jQuery("<bdi/>").clone().addClass("test").appendTo("<div/>").end().hasClass("test"), false, "Check jQuery.fn.appendTo after clone html5 element" );
- strictEqual( jQuery("<p/>").appendTo("<div/>").end().length, jQuery("<p>test</p>").appendTo("<div/>").end().length, "Elements created with createElement and with createDocumentFragment should be treated alike" );
-});
+}); \ No newline at end of file
diff --git a/test/unit/support.js b/test/unit/support.js
index a9243be51..b714a1cec 100644
--- a/test/unit/support.js
+++ b/test/unit/support.js
@@ -98,6 +98,10 @@ if ( /chrome\/16\.0/i.test(userAgent) ) {
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
+ "doesNotAddBorder":true,
+ "doesAddBorderForTableAndCells":false,
+ "fixedPosition":true,
+ "subtractsBorderForOverflowNotVisible":false,
"doesNotIncludeMarginInBodyOffset":true
};
for ( i in expected ) {
@@ -137,6 +141,10 @@ if ( /chrome\/16\.0/i.test(userAgent) ) {
"reliableHiddenOffsets":false,
"ajax":true,
"cors":false,
+ "doesNotAddBorder":false,
+ "doesAddBorderForTableAndCells":true,
+ "fixedPosition":true,
+ "subtractsBorderForOverflowNotVisible":false,
"doesNotIncludeMarginInBodyOffset":true
};
for ( i in expected ) {
@@ -156,8 +164,11 @@ if ( /chrome\/16\.0/i.test(userAgent) ) {
"cors": false,
"cssFloat": false,
"deleteExpando": false,
+ "doesAddBorderForTableAndCells": true,
+ "doesNotAddBorder": true,
"doesNotIncludeMarginInBodyOffset": true,
"enctype": true,
+ "fixedPosition": true,
"focusinBubbles": true,
"getSetAttribute": false,
"hrefNormalized": false,
@@ -175,6 +186,7 @@ if ( /chrome\/16\.0/i.test(userAgent) ) {
"reliableMarginRight": true,
"shrinkWrapBlocks": false,
"submitBubbles": false,
+ "subtractsBorderForOverflowNotVisible": false,
"tbody": false,
"style": false
};
@@ -215,6 +227,10 @@ if ( /chrome\/16\.0/i.test(userAgent) ) {
"reliableHiddenOffsets":false,
"ajax":true,
"cors":false,
+ "doesNotAddBorder":true,
+ "doesAddBorderForTableAndCells":true,
+ "fixedPosition":false,
+ "subtractsBorderForOverflowNotVisible":false,
"doesNotIncludeMarginInBodyOffset":true
};
for ( i in expected ) {
@@ -254,6 +270,10 @@ if ( /chrome\/16\.0/i.test(userAgent) ) {
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
+ "doesNotAddBorder":true,
+ "doesAddBorderForTableAndCells":false,
+ "fixedPosition":true,
+ "subtractsBorderForOverflowNotVisible":false,
"doesNotIncludeMarginInBodyOffset":true
};
for ( i in expected ) {
@@ -293,6 +313,10 @@ if ( /chrome\/16\.0/i.test(userAgent) ) {
"reliableHiddenOffsets":true,
"ajax":true,
"cors":true,
+ "doesNotAddBorder":true,
+ "doesAddBorderForTableAndCells":true,
+ "fixedPosition":true,
+ "subtractsBorderForOverflowNotVisible":false,
"doesNotIncludeMarginInBodyOffset":true
};
for ( i in expected ) {
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index 80d30aa19..8e8b5360a 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -370,27 +370,21 @@ test("not(jQuery)", function() {
});
test("has(Element)", function() {
- expect(3);
+ expect(2);
var obj = jQuery("#qunit-fixture").has(jQuery("#sndp")[0]);
deepEqual( obj.get(), q("qunit-fixture"), "Keeps elements that have the element as a descendant" );
- var detached = jQuery("<a><b><i/></b></a>");
- deepEqual( detached.has( detached.find("i")[0] ).get(), detached.get(), "...Even when detached" );
-
var multipleParent = jQuery("#qunit-fixture, #header").has(jQuery("#sndp")[0]);
deepEqual( obj.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" );
});
test("has(Selector)", function() {
- expect(4);
+ expect(3);
var obj = jQuery("#qunit-fixture").has("#sndp");
deepEqual( obj.get(), q("qunit-fixture"), "Keeps elements that have any element matching the selector as a descendant" );
- var detached = jQuery("<a><b><i/></b></a>");
- deepEqual( detached.has("i").get(), detached.get(), "...Even when detached" );
-
var multipleParent = jQuery("#qunit-fixture, #header").has("#sndp");
deepEqual( obj.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" );
@@ -399,14 +393,11 @@ test("has(Selector)", function() {
});
test("has(Arrayish)", function() {
- expect(4);
+ expect(3);
var simple = jQuery("#qunit-fixture").has(jQuery("#sndp"));
deepEqual( simple.get(), q("qunit-fixture"), "Keeps elements that have any element in the jQuery list as a descendant" );
- var detached = jQuery("<a><b><i/></b></a>");
- deepEqual( detached.has( detached.find("i") ).get(), detached.get(), "...Even when detached" );
-
var multipleParent = jQuery("#qunit-fixture, #header").has(jQuery("#sndp"));
deepEqual( multipleParent.get(), q("qunit-fixture"), "Does not include elements that do not have an element in the jQuery list as a descendant" );