Skip to content

Commit 06ffc5d

Browse files
author
Christopher Rombach
committed
Add test for trigger "changeId"
1 parent d2ea574 commit 06ffc5d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/model.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,4 +1476,15 @@
14761476
assert.equal(model.id, 3);
14771477
});
14781478

1479+
QUnit.test('#4289 - Trigger "changeId" need to be generate only if the content id change', function(assert) {
1480+
assert.expect(1);
1481+
var model = new Backbone.Model({id: 1});
1482+
model.idAttribute = 'id';
1483+
model.on('changeId', function(m) {
1484+
assert.equal(m.get('id'), 2);
1485+
});
1486+
model.set({id: 1});
1487+
model.set({id: 2});
1488+
});
1489+
14791490
})(QUnit);

0 commit comments

Comments
 (0)