Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Commit

Permalink
Set current page comparator to null explicitly which a comparator is …
Browse files Browse the repository at this point in the history
…supplied to the constructor with options.full = true. See #108
  • Loading branch information
wyuenho committed Nov 6, 2013
1 parent 3005c86 commit 5051487
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/backbone-pageable.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
var fullCollection = this.fullCollection;

if (comparator && options.full) {
delete this.comparator;
this.comparator = null;
fullCollection.comparator = comparator;
}

Expand Down
15 changes: 15 additions & 0 deletions test/setsorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ $(document).ready(function () {

module("Backbone.PageableCollection - setSorting");

test("constructor", function () {
var comparator = function () { return 0; };
var Col = Backbone.PageableCollection.extend({
comparator: function () { return 1; }
});
var col = new Col([], {
mode: "client",
comparator: comparator,
full: true
});

ok(col.fullCollection.comparator === comparator);
ok(!col.comparator);
});

test("_makeComparator", function () {
var col, comparator;

Expand Down

0 comments on commit 5051487

Please sign in to comment.