Skip to content

Commit

Permalink
Revert "Added reverse option in the collection sort method"
Browse files Browse the repository at this point in the history
This reverts commit cea2f3f.

Conflicts:
	backbone.js
	test/collection.js
  • Loading branch information
akre54 committed Apr 15, 2014
1 parent 285e07b commit ccdb757
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
2 changes: 0 additions & 2 deletions backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,6 @@
this.models.sort(_.bind(this.comparator, this));
}

if (options.reverse) this.models = this.models.reverse();

if (!options.silent) this.trigger('sort', this, options);
return this;
},
Expand Down
17 changes: 0 additions & 17 deletions test/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,23 +284,6 @@
equal(col.indexOf(tom), 2);
});

test("reverse sort with a sortBy stylecomparator", function() {
var col = new Backbone.Collection;
col.comparator = 'name';
var tom = col.add(new Backbone.Model({name: 'Tom'}));
var rob = col.add(new Backbone.Model({name: 'Rob'}));
var tim = col.add(new Backbone.Model({name: 'Tim'}));

equal(col.indexOf(rob), 0);
equal(col.indexOf(tim), 1);
equal(col.indexOf(tom), 2);

col.sort({reverse: true});
equal(col.indexOf(tom), 0);
equal(col.indexOf(tim), 1);
equal(col.indexOf(rob), 2);
});

test("comparator that depends on `this`", 2, function() {
var col = new Backbone.Collection;
col.negative = function(num) {
Expand Down

0 comments on commit ccdb757

Please sign in to comment.