mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-24 06:17:55 -05:00
Setting _unsetAttributes to false in unset rather than changedAttributes so that the unset attributes aren't lost on subsequent calls of changedAttributes. Added test to verify this behavior.
This commit is contained in:
@@ -253,6 +253,7 @@
|
||||
if (!options.silent) {
|
||||
this.trigger('change:' + attr, this, void 0, options);
|
||||
this.change(options);
|
||||
this._unsetAttributes = false;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
@@ -389,7 +390,6 @@
|
||||
changed[attr] = void 0;
|
||||
}
|
||||
|
||||
this._unsetAttributes = false;
|
||||
return changed;
|
||||
},
|
||||
|
||||
|
||||
@@ -175,7 +175,9 @@ $(document).ready(function() {
|
||||
model.unset('a', {silent: true});
|
||||
var changedAttributes = model.changedAttributes();
|
||||
ok('a' in changedAttributes, 'changedAttributes should contain unset properties');
|
||||
equals(changedAttributes.a, undefined);
|
||||
|
||||
changedAttributes = model.changedAttributes();
|
||||
ok('a' in changedAttributes, 'changedAttributes should contain unset properties when running changedAttributes again after an unset.');
|
||||
});
|
||||
|
||||
test("Model: using a non-default id attribute.", function() {
|
||||
|
||||
Reference in New Issue
Block a user