mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-10 07:27:59 -05:00
Add test for trigger "changeId"
This commit is contained in:
@@ -1476,4 +1476,15 @@
|
||||
assert.equal(model.id, 3);
|
||||
});
|
||||
|
||||
QUnit.test('#4289 - Trigger "changeId" need to be generate only if the content id change', function(assert) {
|
||||
assert.expect(1);
|
||||
var model = new Backbone.Model({id: 1});
|
||||
model.idAttribute = 'id';
|
||||
model.on('changeId', function(m) {
|
||||
assert.equal(m.get('id'), 2);
|
||||
});
|
||||
model.set({id: 1});
|
||||
model.set({id: 2});
|
||||
});
|
||||
|
||||
})(QUnit);
|
||||
|
||||
Reference in New Issue
Block a user