X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;ds=sidebyside;f=test%2Funit%2Fcore.js;h=a6f490c4739ddb5c2c131a640c5ae932fd6bdd56;hb=8e54b167cf60a6efa0e572d31f3886c3cfe74c0b;hp=347864eaf6228a28a5efa5b6541299d6a0435ea1;hpb=6b912beb7b7ba3147112b8291ba3d3deb888bdba;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 347864e..a6f490c 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -386,6 +386,12 @@ test("each(Function)", function() { ok( pass, "Execute a function, Relative" ); }); +test("index()", function() { + expect(1); + + equals( jQuery("#text2").index(), 2, "Returns the index of a child amongst its siblings" ) +}); + test("index(Object|String|undefined)", function() { expect(16); @@ -435,7 +441,7 @@ test("jQuery.merge()", function() { }); test("jQuery.extend(Object, Object)", function() { - expect(20); + expect(23); var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" }, options = { xnumber2: 1, xstring2: "x", xxx: "newstring" }, @@ -460,6 +466,22 @@ test("jQuery.extend(Object, Object)", function() { 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" ); + + empty = {}; + var optionsWithDate = { foo: { date: new Date } }; + jQuery.extend(true, empty, optionsWithDate); + isObj( empty.foo, optionsWithDate.foo, "Dates copy correctly" ); + + var myKlass = function() {}; + empty = {}; + var optionsWithCustomObject = { foo: { date: new myKlass } }; + jQuery.extend(true, empty, optionsWithCustomObject); + isObj( empty.foo, optionsWithCustomObject.foo, "Custom objects copy correctly" ); + var nullUndef; nullUndef = jQuery.extend({}, options, { xnumber2: null }); ok( nullUndef.xnumber2 === null, "Check to make sure null values are copied");