Skip to content

Instantly share code, notes, and snippets.

@tgriesser
Created August 15, 2012 21:11
Show Gist options
  • Save tgriesser/3363709 to your computer and use it in GitHub Desktop.
Save tgriesser/3363709 to your computer and use it in GitHub Desktop.
backbone issue
test("multiple nested changes with silent2", 4, function() {
var changes = [];
var changesa = [];
var model = new Backbone.Model();
model.on('change:b', function(model, val) { changes.push(val); });
model.on('change:a', function(model, val) { changesa.push(val); });
model.on('change', function() {
model.set({b:3}, {silent:true});
model.set({a:3}, {silent:true});
model.set({a:1}, {silent:true});
model.set({b:0}, {silent:true});
});
model.set({b:0, a:1});
deepEqual(changes, [0]);
deepEqual(changesa, [1]);
model.change();
deepEqual(changes, [0]);
deepEqual(changesa, [1]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment