fix regression in setDefaultValues
This commit is contained in:
parent
c49e5bfef9
commit
d8f0ab2a16
2 changed files with 12 additions and 6 deletions
|
|
@ -117,12 +117,19 @@ module.exports = {
|
||||||
assert.equal(o.getOption("initialValue"), 8);
|
assert.equal(o.getOption("initialValue"), 8);
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,10 +90,10 @@ 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 = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue