diff options
author | Scott González <scott.gonzalez@gmail.com> | 2008-05-02 19:49:41 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2008-05-02 19:49:41 +0000 |
commit | 35c68b4578f804bcd10fe7ee1628cbbd263c32ff (patch) | |
tree | 62e351a40452b8148ab25cd75184da127539f65f /test | |
parent | 87758bbe693c77c15e02f485a85e7d993248d190 (diff) | |
download | jquery-35c68b4578f804bcd10fe7ee1628cbbd263c32ff.tar.gz jquery-35c68b4578f804bcd10fe7ee1628cbbd263c32ff.zip |
core: Fixed #2600: jQuery.extend no longer skips over null properties.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/core.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index 053803cd4..7ec825832 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1025,7 +1025,7 @@ test("is(String)", function() { });
test("$.extend(Object, Object)", function() {
- expect(17);
+ expect(20);
var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
@@ -1049,7 +1049,17 @@ test("$.extend(Object, Object)", function() { isObj( deep1.foo, deepmerged.foo, "Check if foo: settings must be extended" );
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 nullUndef;
+ nullUndef = jQuery.extend({}, options, { xnumber2: null });
+ ok( nullUndef.xnumber2 === null, "Check to make sure null values are copied");
+
+ nullUndef = jQuery.extend({}, options, { xnumber2: undefined });
+ ok( nullUndef.xnumber2 === options.xnumber2, "Check to make sure undefined values are not copied");
+
+ nullUndef = jQuery.extend({}, options, { xnumber0: null });
+ ok( nullUndef.xnumber0 === null, "Check to make sure null values are inserted");
+
var target = {};
var recursive = { foo:target, bar:5 };
jQuery.extend(true, target, recursive);
|