Update vendors.

Former-commit-id: 1e93a793891e5f4e2c0d3927f3f38b25bd182263
This commit is contained in:
John-David Dalton
2012-09-15 08:21:44 -07:00
parent ae7e353169
commit 837c15e4f9
6 changed files with 108 additions and 62 deletions

View File

@@ -34,6 +34,15 @@ $(document).ready(function() {
equal(col.length, 4);
});
test("String comparator.", 1, function() {
var collection = new Backbone.Collection([
{id: 3},
{id: 1},
{id: 2}
], {comparator: 'id'});
deepEqual(collection.pluck('id'), [1, 2, 3]);
});
test("new and parse", 3, function() {
var Collection = Backbone.Collection.extend({
parse : function(data) {
@@ -222,7 +231,7 @@ $(document).ready(function() {
equal(col.indexOf(tom), 2);
});
test("comparator that depends on `this`", 1, function() {
test("comparator that depends on `this`", 2, function() {
var col = new Backbone.Collection;
col.negative = function(num) {
return -num;
@@ -231,7 +240,12 @@ $(document).ready(function() {
return this.negative(a.id);
};
col.add([{id: 1}, {id: 2}, {id: 3}]);
equal(col.pluck('id').join(' '), '3 2 1');
deepEqual(col.pluck('id'), [3, 2, 1]);
col.comparator = function(a, b) {
return this.negative(b.id) - this.negative(a.id);
};
col.sort();
deepEqual(col.pluck('id'), [1, 2, 3]);
});
test("remove", 5, function() {