diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-07-16 07:31:55 +0000 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-07-16 07:31:55 +0000 |
commit | 8d52c27808a77f51d1cf42c7e738b0b356466c1a (patch) | |
tree | b75756488594b3797e3631a4c63134e91b45f8ab /test | |
parent | 6b912beb7b7ba3147112b8291ba3d3deb888bdba (diff) | |
download | jquery-8d52c27808a77f51d1cf42c7e738b0b356466c1a.tar.gz jquery-8d52c27808a77f51d1cf42c7e738b0b356466c1a.zip |
jQuery.extend(true, Object, Object) copies objects with length keys correctly
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/core.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index 347864eaf..fe2e992a8 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -435,7 +435,7 @@ test("jQuery.merge()", function() { }); 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" }, @@ -460,6 +460,12 @@ 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" ); + var nullUndef; nullUndef = jQuery.extend({}, options, { xnumber2: null }); ok( nullUndef.xnumber2 === null, "Check to make sure null values are copied"); |