ampersand-collection
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -146,3 +146,7 @@ var BackboneEvents = require('backbone-events-standalone'); | ||
model = toAdd[i]; | ||
if (model.trigger) model.trigger('add', model, this, options); | ||
if (model.trigger) { | ||
model.trigger('add', model, this, options); | ||
} else { | ||
this.trigger('add', model, this, options); | ||
} | ||
} | ||
@@ -181,3 +185,7 @@ if (sort || (order && order.length)) this.trigger('sort', this, options); | ||
options.index = index; | ||
if (model.trigger) model.trigger('remove', model, this, options); | ||
if (model.trigger) { | ||
model.trigger('remove', model, this, options); | ||
} else { | ||
this.trigger('remove', model, this, options); | ||
} | ||
} | ||
@@ -184,0 +192,0 @@ this._removeReference(model, options); |
{ | ||
"name": "ampersand-collection", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -5,0 +5,0 @@ "bugs": { |
@@ -243,1 +243,22 @@ var test = require('tape'); | ||
}); | ||
test('add/remove events should be triggerd with POJO collections', function (t) { | ||
t.plan(4); | ||
var c = new Collection(); | ||
var newModel = { id: 1, foo: 'bar' }; | ||
c.once('add', function (model, collection, options) { | ||
t.equal(model, newModel); | ||
t.equal(collection, c); | ||
}); | ||
c.add(newModel); | ||
c.once('remove', function (model, collection, options) { | ||
t.equal(model.id, 1); | ||
t.equal(collection, c); | ||
}); | ||
c.remove(newModel); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24023
540
1