X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=public%2Fbower_components%2Flodash%2Fvendor%2Fbackbone%2Ftest%2Fcollection.js;h=40a08f15fe0f454d4ba82778b1fc0c4a53a73dfd;hb=6fdab3092eb5921e04b504e7c4b8d9a83a249fb1;hp=dd98aca5c263dbd50df7711af757bd1e34d0935a;hpb=92637af87fcc7d9b13774acc187fd2e85d866a5e;p=motion.git diff --git a/public/bower_components/lodash/vendor/backbone/test/collection.js b/public/bower_components/lodash/vendor/backbone/test/collection.js index dd98aca..40a08f1 100644 --- a/public/bower_components/lodash/vendor/backbone/test/collection.js +++ b/public/bower_components/lodash/vendor/backbone/test/collection.js @@ -101,6 +101,11 @@ assert.equal(collection2.get(model.clone()), collection2.first()); }); + QUnit.test('get with "undefined" id', function(assert) { + var collection = new Backbone.Collection([{id: 1}, {id: 'undefined'}]); + assert.equal(collection.get(1).id, 1); + }); + QUnit.test('has', function(assert) { assert.expect(15); assert.ok(col.has(a)); @@ -1578,7 +1583,7 @@ }); QUnit.test('_addReference binds all collection events & adds to the lookup hashes', function(assert) { - assert.expect(8); + assert.expect(9); var calls = {add: 0, remove: 0}; @@ -1598,6 +1603,7 @@ assert.equal(this._byId[model.id], void 0); assert.equal(this._byId[model.cid], void 0); assert.equal(model.collection, void 0); + assert.equal(model._events, void 0); } }); @@ -1733,14 +1739,13 @@ assert.equal(c2.modelId(m.attributes), void 0); }); - QUnit.test('#3039 #3951: adding at index fires with correct at', function(assert) { - assert.expect(4); - var collection = new Backbone.Collection([{val: 0}, {val: 4}]); + QUnit.test('#3039: adding at index fires with correct at', function(assert) { + assert.expect(3); + var collection = new Backbone.Collection([{at: 0}, {at: 4}]); collection.on('add', function(model, coll, options) { - assert.equal(model.get('val'), options.index); + assert.equal(model.get('at'), options.index); }); - collection.add([{val: 1}, {val: 2}, {val: 3}], {at: 1}); - collection.add({val: 5}, {at: 10}); + collection.add([{at: 1}, {at: 2}, {at: 3}], {at: 1}); }); QUnit.test('#3039: index is not sent when at is not specified', function(assert) { @@ -1898,7 +1903,7 @@ assert.deepEqual(changed.merged, []); assert.ok(changed.removed.length === 2); - assert.ok(_.indexOf(changed.removed, model) > -1 && _.indexOf(changed.removed, model2) > -1); + assert.ok(changed.removed.indexOf(model) > -1 && changed.removed.indexOf(model2) > -1); }); collection.remove([model, model2]); });