[imp] changed get and set
bzr revid: nicolas.vanhoren@openerp.com-20120229102816-8wdpo4ybeq5zrsh7
This commit is contained in:
@@ -316,12 +316,12 @@ nova = (function() {
|
||||
_.each(map, function(val, key) {
|
||||
var tmp = self.__getterSetterInternalMap[key];
|
||||
self.__getterSetterInternalMap[key] = val;
|
||||
self.trigger("changed:" + key, {
|
||||
self.trigger("change:" + key, self, {
|
||||
oldValue: tmp,
|
||||
newValue: val,
|
||||
source: self
|
||||
newValue: val
|
||||
});
|
||||
});
|
||||
self.trigger("change", self);
|
||||
},
|
||||
get: function(key) {
|
||||
return this.__getterSetterInternalMap[key];
|
||||
|
||||
@@ -89,12 +89,12 @@ test("base", function() {
|
||||
x.set({test: 1});
|
||||
equal(x.get("test"), 1);
|
||||
var tmp = 0;
|
||||
x.bind("changed:test", y, function(arg) {
|
||||
x.bind("change:test", y, function(model, options) {
|
||||
tmp = 1;
|
||||
equal(arg.oldValue, 1);
|
||||
equal(arg.newValue, 2);
|
||||
equal(options.oldValue, 1);
|
||||
equal(options.newValue, 2);
|
||||
equal(x.get("test"), 2);
|
||||
equal(arg.source, x);
|
||||
equal(model, x);
|
||||
});
|
||||
x.set({test: 2});
|
||||
equal(tmp, 1);
|
||||
|
||||
Reference in New Issue
Block a user