diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 25f11e2106..9e489557e1 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -503,6 +503,7 @@ OpenLayers.Util.applyDefaults = function (to, from) { to[key] = from[key]; } } + return to; }; /** diff --git a/tests/test_Util.html b/tests/test_Util.html index 48231379a2..32672fea22 100644 --- a/tests/test_Util.html +++ b/tests/test_Util.html @@ -143,7 +143,7 @@ function test_06_Util_applyDefaults(t) { - t.plan(4); + t.plan(8); var to = { 'a': "abra", @@ -161,6 +161,12 @@ t.eq( to["a"], "abra", "key present in to but not from maintained"); t.eq( to["b"], "blorg", "key present in to and from, maintained in to"); t.eq( to["c"], "press", "key present in from and not to successfully copied to to"); + + var ret = OpenLayers.Util.applyDefaults({'a': "abra",'b': "blorg"}, from); + t.ok( ret instanceof Object, " applyDefaults returns an object"); + t.eq( ret["a"], "abra", "key present in ret but not from maintained"); + t.eq( ret["b"], "blorg", "key present in ret and from, maintained in ret"); + t.eq( ret["c"], "press", "key present in from and not ret successfully copied to ret"); } function test_07_Util_getParameterString(t) {