fix regression in setDefaultValues

This commit is contained in:
nightwing 2014-12-12 16:56:02 +04:00
commit d8f0ab2a16
2 changed files with 12 additions and 6 deletions

View file

@ -118,11 +118,18 @@ module.exports = {
o.setOption("initialValue", 7); o.setOption("initialValue", 7);
assert.equal(o.getOption("opt2"), 7); assert.equal(o.getOption("opt2"), 7);
config.setDefaultValues("test_object", {
opt1: 1,
forwarded: 2
});
config.resetOptions(o);
assert.equal(o.getOption("opt1"), 1);
assert.equal(o.getOption("forwarded"), 2);
} }
}; };
}); });
if (typeof module !== "undefined" && module === require.main) { if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec() require("asyncjs").test.testcase(module.exports).exec();
} }

View file

@ -31,7 +31,6 @@
define(function(require, exports, module) { define(function(require, exports, module) {
"no use strict"; "no use strict";
var lang = require("./lang");
var oop = require("./oop"); var oop = require("./oop");
var EventEmitter = require("./event_emitter").EventEmitter; var EventEmitter = require("./event_emitter").EventEmitter;
@ -91,7 +90,7 @@ function reportError(msg, data) {
if (typeof console == "object" && console.error) if (typeof console == "object" && console.error)
console.error(e); console.error(e);
setTimeout(function() { throw e; }); setTimeout(function() { throw e; });
}; }
var AppConfig = function() { var AppConfig = function() {
this.$defaultOptions = {}; this.$defaultOptions = {};
@ -145,7 +144,7 @@ var AppConfig = function() {
this.setDefaultValues = function(path, optionHash) { this.setDefaultValues = function(path, optionHash) {
Object.keys(optionHash).forEach(function(key) { Object.keys(optionHash).forEach(function(key) {
this.setDefaultValue(path, key, optionHash[key]); this.setDefaultValue(path, key, optionHash[key]);
}); }, this);
}; };
this.warn = warn; this.warn = warn;