Skip to content

Commit

Permalink
Upodated to lodash 4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jboelen committed Apr 12, 2017
1 parent 71123a8 commit a6a1405
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 41 deletions.
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function(config) {
'node_modules/qunitjs/qunit/qunit.css',
'node_modules/sinon/pkg/sinon.js',
'node_modules/jquery/dist/jquery.js',
'node_modules/underscore/underscore.js',
'node_modules/lodash/lodash.js',
'node_modules/backbone/backbone.js',
'lib/backbone.paginator.js',
'test/setup/*.js',
Expand Down
8 changes: 4 additions & 4 deletions lib/backbone.paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

// CommonJS
if (typeof exports == "object" && typeof require == "function") {
module.exports = factory(require("underscore"), require("backbone"));
module.exports = factory(require("lodash"), require("backbone"));
}
// AMD
else if (typeof define == "function" && define.amd) {
define(["underscore", "backbone"], factory);
define(["lodash", "backbone"], factory);
}
// Browser
else if (typeof _ !== "undefined" && typeof Backbone !== "undefined") {
Expand Down Expand Up @@ -54,9 +54,9 @@
var _clone = _.clone;
var _each = _.each;
var _pick = _.pick;
var _contains = _.contains;
var _contains = _.includes;
var _isEmpty = _.isEmpty;
var _pairs = _.pairs;
var _pairs = _.toPairs;
var _invert = _.invert;
var _isArray = _.isArray;
var _isFunction = _.isFunction;
Expand Down
26 changes: 14 additions & 12 deletions lib/backbone.paginator.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
!function(a){
// CommonJS
if("object"==typeof exports&&"function"==typeof require)module.exports=a(require("underscore"),require("backbone"));else if("function"==typeof define&&define.amd)define(["underscore","backbone"],a);else if("undefined"!=typeof _&&"undefined"!=typeof Backbone){var b=Backbone.PageableCollection,c=a(_,Backbone);/**
if("object"==typeof exports&&"function"==typeof require)module.exports=a(require("lodash"),require("backbone"));else if("function"==typeof define&&define.amd)define(["lodash","backbone"],a);else if("undefined"!=typeof _&&"undefined"!=typeof Backbone){var b=Backbone.PageableCollection,c=a(_,Backbone);/**
__BROWSER ONLY__
If you already have an object named `PageableCollection` attached to the
Expand All @@ -25,10 +25,10 @@ if("object"==typeof exports&&"function"==typeof require)module.exports=a(require
@static
@return {PageableCollection}
*/
Backbone.PageableCollection.noConflict=function(){return Backbone.PageableCollection=b,c}}}(function(a,b){"use strict";function c(b,c){if(!a.isNumber(b)||a.isNaN(b)||!a.isFinite(b)||~~b!==b)throw new TypeError("`"+c+"` must be a finite integer");return b}function d(a){for(var b,c,d,e,f={},g=decodeURIComponent,h=a.split("&"),i=0,j=h.length;j>i;i++){var k=h[i];b=k.split("="),c=b[0],d=b[1],null==d&&(d=!0),c=g(c),d=g(d),e=f[c],o(e)?e.push(d):e?f[c]=[e,d]:f[c]=d}return f}
Backbone.PageableCollection.noConflict=function(){return Backbone.PageableCollection=b,c}}}(function(a,b){"use strict";function c(b,c){if(!a.isNumber(b)||a.isNaN(b)||!a.isFinite(b)||~~b!==b)throw new TypeError("`"+c+"` must be a finite integer");return b}function d(a){for(var b,c,d,e,f={},g=decodeURIComponent,h=a.split("&"),i=0,j=h.length;i<j;i++){var k=h[i];b=k.split("="),c=b[0],d=b[1],null==d&&(d=!0),c=g(c),d=g(d),e=f[c],o(e)?e.push(d):e?f[c]=[e,d]:f[c]=d}return f}
// hack to make sure the whatever event handlers for this event is run
// before func is, and the event handlers that func will trigger.
function e(a,b,c){var d=a._events[b];if(d&&d.length){var e=d[d.length-1],f=e.callback;e.callback=function(){try{f.apply(this,arguments),c()}catch(a){throw a}finally{e.callback=f}}}else c()}var f=a.extend,g=a.omit,h=a.clone,i=a.each,j=a.pick,k=a.contains,l=a.isEmpty,m=a.pairs,n=a.invert,o=a.isArray,p=a.isFunction,q=a.isObject,r=a.keys,s=a.isUndefined,t=Math.ceil,u=Math.floor,v=Math.max,w=b.Collection.prototype,x=/[\s'"]/g,y=/[<>\s'"]/g,z=b.PageableCollection=b.Collection.extend({/**
function e(a,b,c){var d=a._events[b];if(d&&d.length){var e=d[d.length-1],f=e.callback;e.callback=function(){try{f.apply(this,arguments),c()}catch(a){throw a}finally{e.callback=f}}}else c()}var f=a.extend,g=a.omit,h=a.clone,i=a.each,j=a.pick,k=a.includes,l=a.isEmpty,m=a.toPairs,n=a.invert,o=a.isArray,p=a.isFunction,q=a.isObject,r=a.keys,s=a.isUndefined,t=Math.ceil,u=Math.floor,v=Math.max,w=b.Collection.prototype,x=/[\s'"]/g,y=/[<>\s'"]/g,z=b.PageableCollection=b.Collection.extend({/**
The container object to store all pagination states.
You can override the default state by extending this class or specifying
Expand Down Expand Up @@ -159,7 +159,7 @@ l(a)||(this.reset(a,f({silent:!0},b)),this.getPage(e.currentPage),a.splice.apply
@param {Object} options Options for Backbone.Collection constructor.
@return {Backbone.Collection}
*/
_makeFullCollection:function(a,c){var d,e,f,g=["url","model","sync","comparator"],h=this.constructor.prototype,i={};for(d=0,e=g.length;e>d;d++)f=g[d],s(h[f])||(i[f]=h[f]);var j=new(b.Collection.extend(i))(a,c);for(d=0,e=g.length;e>d;d++)f=g[d],this[f]!==h[f]&&(j[f]=this[f]);return j},/**
_makeFullCollection:function(a,c){var d,e,f,g=["url","model","sync","comparator"],h=this.constructor.prototype,i={};for(d=0,e=g.length;d<e;d++)f=g[d],s(h[f])||(i[f]=h[f]);var j=new(b.Collection.extend(i))(a,c);for(d=0,e=g.length;d<e;d++)f=g[d],this[f]!==h[f]&&(j[f]=this[f]);return j},/**
Factory method that returns a Backbone event handler that responses to
the `add`, `remove`, `reset`, and the `sort` events. The returned event
handler will synchronize the current page collection and the full
Expand All @@ -176,11 +176,11 @@ _makeFullCollection:function(a,c){var d,e,f,g=["url","model","sync","comparator"
@return {function(string, Backbone.Model, Backbone.Collection, Object)}
Collection event handler
*/
_makeCollectionEventHandler:function(a,b){return function(c,d,g,j){var k=a._handlers;i(r(k),function(c){var d=k[c];a.off(c,d),b.off(c,d)});var l=h(a.state),m=l.firstPage,n=0===m?l.currentPage:l.currentPage-1,o=l.pageSize,p=n*o,q=p+o;if("add"==c){var u,v,w,x,j=j||{};if(g==b)v=b.indexOf(d),v>=p&&q>v&&(x=a,u=w=v-p);else{u=a.indexOf(d),v=p+u,x=b;var w=s(j.at)?v:j.at+p}if(j.onRemove||(++l.totalRecords,delete j.onRemove),a.state=a._checkState(l),x){x.add(d,f({},j,{at:w}));var y=u>=o?d:!s(j.at)&&q>w&&a.length>o?a.at(o):null;y&&e(g,c,function(){a.remove(y,{onAdd:!0})})}j.silent||a.trigger("pageable:state:change",a.state)}
_makeCollectionEventHandler:function(a,b){return function(c,d,g,j){var k=a._handlers;i(r(k),function(c){var d=k[c];a.off(c,d),b.off(c,d)});var l=h(a.state),m=l.firstPage,n=0===m?l.currentPage:l.currentPage-1,o=l.pageSize,p=n*o,q=p+o;if("add"==c){var u,v,w,x,j=j||{};if(g==b)v=b.indexOf(d),v>=p&&v<q&&(x=a,u=w=v-p);else{u=a.indexOf(d),v=p+u,x=b;var w=s(j.at)?v:j.at+p}if(j.onRemove||(++l.totalRecords,delete j.onRemove),a.state=a._checkState(l),x){x.add(d,f({},j,{at:w}));var y=u>=o?d:!s(j.at)&&w<q&&a.length>o?a.at(o):null;y&&e(g,c,function(){a.remove(y,{onAdd:!0})})}j.silent||a.trigger("pageable:state:change",a.state)}
// remove the model from the other collection as well
if("remove"==c){if(j.onAdd)delete j.onAdd;else{
// decrement totalRecords and update totalPages and lastPage
if(--l.totalRecords){var z=l.totalPages=t(l.totalRecords/o);l.lastPage=0===m?z-1:z||m,l.currentPage>z&&(l.currentPage=l.lastPage)}else l.totalRecords=null,l.totalPages=null;a.state=a._checkState(l);var A,B=j.index;g==a?((A=b.at(q))?e(a,c,function(){a.push(A,{onRemove:!0})}):!a.length&&l.totalRecords&&a.reset(b.models.slice(p-o,q-o),f({},j,{parse:!1})),b.remove(d)):B>=p&&q>B&&((A=b.at(q-1))&&e(a,c,function(){a.push(A,{onRemove:!0})}),a.remove(d),!a.length&&l.totalRecords&&a.reset(b.models.slice(p-o,q-o),f({},j,{parse:!1})))}j.silent||a.trigger("pageable:state:change",a.state)}if("reset"==c){
if(--l.totalRecords){var z=l.totalPages=t(l.totalRecords/o);l.lastPage=0===m?z-1:z||m,l.currentPage>z&&(l.currentPage=l.lastPage)}else l.totalRecords=null,l.totalPages=null;a.state=a._checkState(l);var A,B=j.index;g==a?((A=b.at(q))?e(a,c,function(){a.push(A,{onRemove:!0})}):!a.length&&l.totalRecords&&a.reset(b.models.slice(p-o,q-o),f({},j,{parse:!1})),b.remove(d)):B>=p&&B<q&&((A=b.at(q-1))&&e(a,c,function(){a.push(A,{onRemove:!0})}),a.remove(d),!a.length&&l.totalRecords&&a.reset(b.models.slice(p-o,q-o),f({},j,{parse:!1})))}j.silent||a.trigger("pageable:state:change",a.state)}if("reset"==c){
// Reset that's not a result of getPage
if(j=g,g=d,g==a&&null==j.from&&null==j.to){var C=b.models.slice(0,p),D=b.models.slice(p+a.models.length);b.reset(C.concat(a.models).concat(D),j)}else g==b&&((l.totalRecords=b.models.length)||(l.totalRecords=null,l.totalPages=null),"client"==a.mode&&(m=l.lastPage=l.currentPage=l.firstPage,n=0===m?l.currentPage:l.currentPage-1,p=n*o,q=p+o),a.state=a._checkState(l),a.reset(b.models.slice(p,q),f({},j,{parse:!1})));j.silent||a.trigger("pageable:state:change",a.state)}"sort"==c&&(j=g,g=d,g===b&&a.reset(b.models.slice(p,q),f({},j,{parse:!1}))),i(r(k),function(c){var d=k[c];i([a,b],function(a){a.on(c,d);var b=a._events[c]||[];b.unshift(b.pop())})})}},/**
Sanity check this collection's pagination states. Only perform checks
Expand All @@ -199,7 +199,7 @@ if(j=g,g=d,g==a&&null==j.from&&null==j.to){var C=b.models.slice(0,p),D=b.models.
@return {Object} Returns the `state` object if no error was found.
*/
_checkState:function(a){var b=this.mode,d=this.links,e=a.totalRecords,f=a.pageSize,g=a.currentPage,h=a.firstPage,i=a.totalPages;if(null!=e&&null!=f&&null!=g&&null!=h&&("infinite"==b?d:!0)){if(e=c(e,"totalRecords"),f=c(f,"pageSize"),g=c(g,"currentPage"),h=c(h,"firstPage"),1>f)throw new RangeError("`pageSize` must be >= 1");if(i=a.totalPages=t(e/f),0>h||h>1)throw new RangeError("`firstPage must be 0 or 1`");if(a.lastPage=0===h?v(0,i-1):i||h,"infinite"==b){if(!d[g+""])throw new RangeError("No link found for page "+g)}else if(h>g||i>0&&(h?g>i:g>=i))throw new RangeError("`currentPage` must be firstPage <= currentPage "+(h?"<":"<=")+" totalPages if "+h+"-based. Got "+g+".")}return a},/**
_checkState:function(a){var b=this.mode,d=this.links,e=a.totalRecords,f=a.pageSize,g=a.currentPage,h=a.firstPage,i=a.totalPages;if(null!=e&&null!=f&&null!=g&&null!=h&&("infinite"!=b||d)){if(e=c(e,"totalRecords"),f=c(f,"pageSize"),g=c(g,"currentPage"),h=c(h,"firstPage"),f<1)throw new RangeError("`pageSize` must be >= 1");if(i=a.totalPages=t(e/f),h<0||h>1)throw new RangeError("`firstPage must be 0 or 1`");if(a.lastPage=0===h?v(0,i-1):i||h,"infinite"==b){if(!d[g+""])throw new RangeError("No link found for page "+g)}else if(g<h||i>0&&(h?g>i:g>=i))throw new RangeError("`currentPage` must be firstPage <= currentPage "+(h?"<":"<=")+" totalPages if "+h+"-based. Got "+g+".")}return a},/**
Change the page size of this collection.
Under most if not all circumstances, you should call this method to
Expand Down Expand Up @@ -269,7 +269,7 @@ setPageSize:function(a,b){a=c(a,"pageSize"),b=b||{first:!1};var d=this.state,e=t
@return {XMLHttpRequest|PageableCollection} The XMLHttpRequest
from fetch or this if `options.fetch` is `false`.
*/
switchMode:function(b,c){if(!k(["server","client","infinite"],b))throw new TypeError('`mode` must be one of "server", "client" or "infinite"');c=c||{fetch:!0,resetState:!0};var d=this.state=c.resetState?h(this._initState):this._checkState(f({},this.state));this.mode=b;var e,j=this,l=this.fullCollection,m=this._handlers=this._handlers||{};if("server"==b||l)"server"==b&&l&&(i(r(m),function(a){e=m[a],j.off(a,e),l.off(a,e)}),delete this._handlers,this._fullComparator=l.comparator,delete this.fullCollection);else{l=this._makeFullCollection(c.models||[],c),l.pageableCollection=this,this.fullCollection=l;var n=this._makeCollectionEventHandler(this,l);i(["add","remove","reset","sort"],function(b){m[b]=e=a.bind(n,{},b),j.on(b,e),l.on(b,e)}),l.comparator=this._fullComparator}if("infinite"==b)for(var o=this.links={},p=d.firstPage,q=t(d.totalRecords/d.pageSize),s=0===p?v(0,q-1):q||p,u=d.firstPage;s>=u;u++)o[u]=this.url;else this.links&&delete this.links;return c.silent||this.trigger("pageable:state:change",d),c.fetch?this.fetch(g(c,"fetch","resetState")):this},/**
switchMode:function(b,c){if(!k(["server","client","infinite"],b))throw new TypeError('`mode` must be one of "server", "client" or "infinite"');c=c||{fetch:!0,resetState:!0};var d=this.state=c.resetState?h(this._initState):this._checkState(f({},this.state));this.mode=b;var e,j=this,l=this.fullCollection,m=this._handlers=this._handlers||{};if("server"==b||l)"server"==b&&l&&(i(r(m),function(a){e=m[a],j.off(a,e),l.off(a,e)}),delete this._handlers,this._fullComparator=l.comparator,delete this.fullCollection);else{l=this._makeFullCollection(c.models||[],c),l.pageableCollection=this,this.fullCollection=l;var n=this._makeCollectionEventHandler(this,l);i(["add","remove","reset","sort"],function(b){m[b]=e=a.bind(n,{},b),j.on(b,e),l.on(b,e)}),l.comparator=this._fullComparator}if("infinite"==b)for(var o=this.links={},p=d.firstPage,q=t(d.totalRecords/d.pageSize),s=0===p?v(0,q-1):q||p,u=d.firstPage;u<=s;u++)o[u]=this.url;else this.links&&delete this.links;return c.silent||this.trigger("pageable:state:change",d),c.fetch?this.fetch(g(c,"fetch","resetState")):this},/**
@return {boolean} `true` if this collection can page backward, `false`
otherwise.
*/
Expand Down Expand Up @@ -360,7 +360,7 @@ getPage:function(a,b){var d=this.mode,e=this.fullCollection;b=b||{fetch:!1};var
@return {XMLHttpRequest|PageableCollection} The XMLHttpRequest
from fetch or this.
*/
getPageByOffset:function(a,b){if(0>a)throw new RangeError("`offset must be > 0`");a=c(a);var d=u(a/this.state.pageSize);return 0!==this.state.firstPage&&d++,d>this.state.lastPage&&(d=this.state.lastPage),this.getPage(d,b)},/**
getPageByOffset:function(a,b){if(a<0)throw new RangeError("`offset must be > 0`");a=c(a);var d=u(a/this.state.pageSize);return 0!==this.state.firstPage&&d++,d>this.state.lastPage&&(d=this.state.lastPage),this.getPage(d,b)},/**
Overidden to make `getPage` compatible with Zepto.
@param {string} method
Expand Down Expand Up @@ -490,15 +490,17 @@ parseRecords:function(a,b){return a&&2===a.length&&q(a[0])&&o(a[1])?a[1]:a},/**
@return {XMLHttpRequest}
*/
fetch:function(b){b=b||{};var c=this._checkState(this.state),e=this.mode;"infinite"!=e||b.url||(b.url=this.links[c.currentPage]);var h=b.data||{},i=b.url||this.url||"";p(i)&&(i=i.call(this));var k=i.indexOf("?");-1!=k&&(f(h,d(i.slice(k+1))),i=i.slice(0,k)),b.url=i,b.data=h;
fetch:function(b){b=b||{};var c=this._checkState(this.state),e=this.mode;"infinite"!=e||b.url||(b.url=this.links[c.currentPage]);var h=b.data||{},i=b.url||this.url||"";p(i)&&(i=i.call(this));var k=i.indexOf("?");k!=-1&&(f(h,d(i.slice(k+1))),i=i.slice(0,k)),b.url=i,b.data=h;
// map params except directions
var l="client"==this.mode?j(this.queryParams,"sortKey","order"):g(j(this.queryParams,r(A.queryParams)),"directions"),n=a.clone(this);a.each(l,function(b,d){b=p(b)?b.call(n):b,null!=c[d]&&null!=b&&a.isUndefined(h[b])&&(h[b]=c[d])},this);
// fix up sorting parameters
var q;if(c.sortKey&&c.order){var t=p(l.order)?l.order.call(n):l.order;if(o(c.order))for(h[t]=[],q=0;q<c.order.length;q+=1)h[t].push(this.queryParams.directions[c.order[q]]);else h[t]=this.queryParams.directions[c.order+""]}else c.sortKey||delete h[l.order];
// map extra query parameters
var u,v,x=m(g(this.queryParams,r(A.queryParams)));for(q=0;q<x.length;q++)u=x[q],v=u[1],v=p(v)?v.call(n):v,null!=v&&(h[u[0]]=v);if("server"!=e){var y=this,z=this.fullCollection,B=b.success;
// silent the first reset from backbone
return b.success=function(a,c,d){d=d||{},s(b.silent)?delete d.silent:d.silent=b.silent;var g=a.models;"client"==e?z.reset(g,d):(z.add(g,f({at:z.length},f(d,{parse:!1}))),y.trigger("reset",y,d)),B&&B(a,c,d)},w.fetch.call(this,f({},b,{silent:!0}))}return w.fetch.call(this,b)},/**
return b.success=function(a,c,d){
// make sure the caller's intent is obeyed
d=d||{},s(b.silent)?delete d.silent:d.silent=b.silent;var g=a.models;"client"==e?z.reset(g,d):(z.add(g,f({at:z.length},f(d,{parse:!1}))),y.trigger("reset",y,d)),B&&B(a,c,d)},w.fetch.call(this,f({},b,{silent:!0}))}return w.fetch.call(this,b)},/**
Convenient method for making a `comparator` sorted by a model attribute
identified by `sortKey` and ordered by `order`.
Expand Down Expand Up @@ -527,7 +529,7 @@ return b.success=function(a,c,d){d=d||{},s(b.silent)?delete d.silent:d.silent=b.
See [Backbone.Collection.comparator](http://backbonejs.org/#Collection-comparator).
*/
_makeComparator:function(a,b,c){var d=this.state;return a=a||d.sortKey,b=b||d.order,a&&b?(c||(c=function(a,b){return a.get(b)}),function(d,e){var f,g=c(d,a),h=c(e,a);return 1===b&&(f=g,g=h,h=f),g===h?0:h>g?-1:1}):void 0},/**
_makeComparator:function(a,b,c){var d=this.state;if(a=a||d.sortKey,b=b||d.order,a&&b)return c||(c=function(a,b){return a.get(b)}),function(d,e){var f,g=c(d,a),h=c(e,a);return 1===b&&(f=g,g=h,h=f),g===h?0:g<h?-1:1}},/**
Adjusts the sorting for this pageable collection.
Given a `sortKey` and an `order`, sets `state.sortKey` and
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "https://github.com/backbone-paginator/backbone.paginator/issues"
},
"dependencies": {
"underscore": "^1.8.0",
"lodash": "^4.17.4",
"backbone": "1.1.2 || 1.2.3 || ^1.3.2"
},
"devDependencies": {
Expand All @@ -38,6 +38,7 @@
"sinon": "^1.17.3"
},
"scripts": {
"test": "karma start --single-run --browsers Chrome,Firefox"
"test": "karma start --single-run --browsers Chrome,Firefox",
"build": "grunt"
}
}
25 changes: 4 additions & 21 deletions test/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,17 +687,17 @@
});

QUnit.test('Underscore methods', function(assert) {
assert.expect(21);
assert.expect(20);
assert.equal(col.map(function(model){ return model.get('label'); }).join(' '), 'a b c d');
assert.equal(col.some(function(model){ return model.id === 100; }), false);
assert.equal(col.some(function(model){ return model.id === 0; }), true);
assert.equal(col.reduce(function(m1, m2) {return m1.id > m2.id ? m1 : m2;}).id, 3);
assert.equal(col.reduceRight(function(m1, m2) {return m1.id > m2.id ? m1 : m2;}).id, 3);
assert.equal(col.indexOf(b), 1);
assert.equal(col.size(), 4);
assert.equal(col.rest().length, 3);
assert.ok(!_.includes(col.rest(), a));
assert.ok(_.includes(col.rest(), d));
assert.equal(col.tail().length, 3);
assert.ok(!_.includes(col.tail(), a));
assert.ok(_.includes(col.tail(), d));
assert.ok(!col.isEmpty());
assert.ok(!_.includes(col.without(d), d));

Expand All @@ -716,7 +716,6 @@
assert.deepEqual(col.groupBy(function(model){ return model.id; })[first.id], [first]);
assert.deepEqual(col.countBy(function(model){ return model.id; }), {0: 1, 1: 1, 2: 1, 3: 1});
assert.deepEqual(col.sortBy(function(model){ return model.id; })[0], col.at(3));
assert.ok(col.indexBy('id')[first.id] === first);
});

QUnit.test('Underscore methods with object-style and property-style iteratee', function(assert) {
Expand Down Expand Up @@ -1842,22 +1841,6 @@
collection.set([{id: 1}, {id: 2}]);
});

QUnit.test('#3610 - invoke collects arguments', function(assert) {
assert.expect(3);
var Model = Backbone.Model.extend({
method: function(x, y, z) {
assert.equal(x, 1);
assert.equal(y, 2);
assert.equal(z, 3);
}
});
var Collection = Backbone.Collection.extend({
model: Model
});
var collection = new Collection([{id: 1}]);
collection.invoke('method', 1, 2, 3);
});

QUnit.test('#3662 - triggering change without model will not error', function(assert) {
assert.expect(1);
var collection = new Backbone.Collection([{id: 1}]);
Expand Down
2 changes: 1 addition & 1 deletion test/infinite-pageable.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ $(document).ready(function () {
// makes sure collection events on the current page are not suppressed when
// refetching the same page
col.on("all", function (event) {
if (!_.contains(["request", "sync", "reset", "pageable:state:change"], event)) {
if (!_.includes(["request", "sync", "reset", "pageable:state:change"], event)) {
ok(false);
}
});
Expand Down

0 comments on commit a6a1405

Please sign in to comment.