expect(11);
// Basic constructor's behavior
-
+
equals( jQuery().length, 1, "jQuery() === jQuery(document)" );
equals( jQuery(undefined).length, 0, "jQuery(undefined) === jQuery([])" );
equals( jQuery(null).length, 0, "jQuery(null) === jQuery([])" );
equals( jQuery("").length, 0, "jQuery('') === jQuery([])" );
-
+
// can actually yield more than one, when iframes are included, the window is an array as well
equals( 1, jQuery(window).length, "Correct number of elements generated for jQuery(window)" );
-
-
+
+
var main = jQuery("#main");
isSet( jQuery("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );
});
test("jQuery.extend(Object, Object)", function() {
- expect(20);
+ expect(21);
var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
isObj( deep2.foo, deep2copy.foo, "Check if not deep2: options must not be modified" );
equals( deep1.foo2, document, "Make sure that a deep clone was not attempted on the document" );
+ var empty = {};
+ var optionsWithLength = { foo: { length: -1 } };
+ jQuery.extend(true, empty, optionsWithLength);
+
+ isObj( empty.foo, optionsWithLength.foo, "The length property must copy correctly" );
+
var nullUndef;
nullUndef = jQuery.extend({}, options, { xnumber2: null });
ok( nullUndef.xnumber2 === null, "Check to make sure null values are copied");
total = 0;
jQuery.each({"a":3,"b":3,"c":3}, function(i,v){ total += v; return false; });
equals( total, 3, "Looping over an object, with break" );
-
+
var f = function(){};
f.foo = 'bar';
jQuery.each(f, function(i){