check for duplicate models/ids

This commit is contained in:
Brad Dunbar
2012-01-30 15:24:41 -05:00
parent fb97ef1e86
commit 50e8103fdf
2 changed files with 11 additions and 4 deletions

View File

@@ -527,4 +527,11 @@ $(document).ready(function() {
equal(col.length, 0);
});
test("Collection: multiple copies of the same model", function() {
var col = new Backbone.Collection();
var model = new Backbone.Model();
raises(function() { col.add([model, model]) });
raises(function() { col.add([{id: 1}, {id: 1}]); });
});
});