Add test for trigger "changeId"

This commit is contained in:
Christopher Rombach
2024-09-02 14:13:43 +02:00
parent d2ea5746fe
commit 06ffc5d1e3

View File

@@ -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);