Update vendors and dev deps.

This commit is contained in:
John-David Dalton
2016-01-28 00:24:55 -08:00
parent 97612f3b31
commit 7bf7ab954b
11 changed files with 66 additions and 60 deletions

View File

@@ -9,8 +9,8 @@
// Establish the root object, `window` (`self`) in the browser, or `global` on the server.
// We use `self` instead of `window` for `WebWorker` support.
var root = (typeof self == 'object' && self.self == self && self) ||
(typeof global == 'object' && global.global == global && global);
var root = (typeof self == 'object' && self.self === self && self) ||
(typeof global == 'object' && global.global === global && global);
// Set up Backbone appropriately for the environment. Start with AMD.
if (typeof define === 'function' && define.amd) {
@@ -769,7 +769,8 @@
at = Math.min(Math.max(at, 0), array.length);
var tail = Array(array.length - at);
var length = insert.length;
for (var i = 0; i < tail.length; i++) tail[i] = array[i + at];
var i;
for (i = 0; i < tail.length; i++) tail[i] = array[i + at];
for (i = 0; i < length; i++) array[i + at] = insert[i];
for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];
};
@@ -821,10 +822,12 @@
if (models == null) return;
options = _.defaults({}, options, setOptions);
if (options.parse && !this._isModel(models)) models = this.parse(models, options);
if (options.parse && !this._isModel(models)) {
models = this.parse(models, options) || [];
}
var singular = !_.isArray(models);
models = singular ? (models ? [models] : []) : models.slice();
models = singular ? [models] : models.slice();
var at = options.at;
if (at != null) at = +at;
@@ -845,8 +848,8 @@
// Turn bare objects into model references, and prevent invalid models
// from being added.
var model;
for (var i = 0; i < models.length; i++) {
var model, i;
for (i = 0; i < models.length; i++) {
model = models[i];
// If a duplicate is found, prevent it from being added and
@@ -890,7 +893,7 @@
var orderChanged = false;
var replace = !sortable && add && remove;
if (set.length && replace) {
orderChanged = this.length != set.length || _.some(this.models, function(model, index) {
orderChanged = this.length !== set.length || _.some(this.models, function(model, index) {
return model !== set[index];
});
this.models.length = 0;

View File

@@ -429,7 +429,7 @@
});
var colE = new Backbone.Collection([e]);
var colF = new Backbone.Collection([f]);
assert.ok(e != f);
assert.notEqual(e, f);
assert.ok(colE.length === 1);
assert.ok(colF.length === 1);
colE.remove(e);
@@ -857,7 +857,7 @@
assert.expect(2);
var Model = Backbone.Model.extend({
validate: function(attrs) {
if (attrs.id == 3) return "id can't be 3";
if (attrs.id === 3) return "id can't be 3";
}
});
@@ -1324,7 +1324,7 @@
var col = new Backbone.Collection;
var model1 = col.push({id: 101});
var model2 = col.push({id: 101});
assert.ok(model2.cid == model1.cid);
assert.ok(model2.cid === model1.cid);
});
QUnit.test('`set` with non-normal id', function(assert) {

View File

@@ -352,8 +352,8 @@
_.extend(obj, Backbone.Events);
obj.on('all', function(event) {
obj.counter++;
if (event == 'a') a = true;
if (event == 'b') b = true;
if (event === 'a') a = true;
if (event === 'b') b = true;
})
.trigger('a b');
assert.ok(a);
@@ -477,7 +477,7 @@
QUnit.test('if callback is truthy but not a function, `on` should throw an error just like jQuery', function(assert) {
assert.expect(1);
var view = _.extend({}, Backbone.Events).on('test', 'noop');
assert.throws(function() {
assert.raises(function() {
view.trigger('test');
});
});

View File

@@ -89,7 +89,7 @@
doc.collection.url = '/collection/';
assert.equal(doc.url(), '/collection/1-the-tempest');
doc.collection = null;
assert.throws(function() { doc.url(); });
assert.raises(function() { doc.url(); });
doc.collection = collection;
});
@@ -251,12 +251,12 @@
var changeCount = 0;
a.on('change:foo', function() { changeCount += 1; });
a.set({foo: 2});
assert.ok(a.get('foo') == 2, 'Foo should have changed.');
assert.ok(changeCount == 1, 'Change count should have incremented.');
assert.equal(a.get('foo'), 2, 'Foo should have changed.');
assert.equal(changeCount, 1, 'Change count should have incremented.');
// set with value that is not new shouldn't fire change event
a.set({foo: 2});
assert.ok(a.get('foo') == 2, 'Foo should NOT have changed, still 2');
assert.ok(changeCount == 1, 'Change count should NOT have incremented.');
assert.equal(a.get('foo'), 2, 'Foo should NOT have changed, still 2');
assert.equal(changeCount, 1, 'Change count should NOT have incremented.');
a.validate = function(attrs) {
assert.equal(attrs.foo, void 0, 'validate:true passed while unsetting');
@@ -264,7 +264,7 @@
a.unset('foo', {validate: true});
assert.equal(a.get('foo'), void 0, 'Foo should have changed');
delete a.validate;
assert.ok(changeCount == 2, 'Change count should have incremented for unset.');
assert.equal(changeCount, 2, 'Change count should have incremented for unset.');
a.unset('id');
assert.equal(a.id, undefined, 'Unsetting the id should remove the id property.');
@@ -746,7 +746,7 @@
var lastError;
var model = new Backbone.Model();
model.validate = function(attrs) {
if (attrs.admin != this.get('admin')) return "Can't change admin status.";
if (attrs.admin !== this.get('admin')) return "Can't change admin status.";
};
model.on('invalid', function(model, error) {
lastError = error;

View File

@@ -134,7 +134,7 @@
},
optionalItem: function(arg){
this.arg = arg != void 0 ? arg : null;
this.arg = arg !== void 0 ? arg : null;
},
splat: function(args) {

View File

@@ -142,7 +142,7 @@
QUnit.test('urlError', function(assert) {
assert.expect(2);
var model = new Backbone.Model();
assert.throws(function() {
assert.raises(function() {
model.fetch();
});
model.fetch({url: '/one/two'});