backbone-db
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -139,2 +139,3 @@ var Backbone = require('backbone'); | ||
var limit = options.limit ? options.limit : models.length; | ||
if(options.where) models = _.where(models, options.where); | ||
if(options.sort) models.sort(sort(options.sort)); | ||
@@ -141,0 +142,0 @@ if(options.after_id) { |
{ | ||
"name": "backbone-db", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Key-Value database storage interface, localStorage and in-process implementations", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -155,2 +155,17 @@ var Db = require('../'); | ||
it('should fetch collection filtered with given attributes', function(t) { | ||
var collection = new MyCollection(); | ||
collection.fetch({ | ||
where: {test: 2}, | ||
success: function() { | ||
assert.equal(collection.length, 1); | ||
assert.equal(collection.at(0).get('test'), 2); | ||
t(); | ||
}, | ||
error: function(err){ | ||
assert(err); | ||
} | ||
}); | ||
}); | ||
it('should remove a model from collection when destroyed', function(t) { | ||
@@ -157,0 +172,0 @@ var m = new MyCollection(); |
Sorry, the diff of this file is not supported yet
2741
117814