Skip to content

Commit

Permalink
Merge branch 'master' of github.com:catarse/mithril.postgrest
Browse files Browse the repository at this point in the history
  • Loading branch information
diogob committed Nov 30, 2015
2 parents 1340214 + e59ab55 commit f4ace7f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/mithril.postgrest.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mithril.postgrest.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions spec/filtersVM.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ describe("m.postgrest.filtersVM", function(){
expect(vm.parameters()).toEqual({id: 'eq.7', name: 'ilike.*foo*', order: 'name.asc,id.desc', value: ['gte.1', 'lte.2'], full_text: '@@.foo&bar&qux', deactivated_at: 'not.is.null'});
});

it("the chain function should build an object for the request using PostgREST syntax", function() {
var chain = vm.id(7).name('foo').value.gte(1).value.lte(2).full_text(' foo bar qux ').deactivated_at(!null).order({name: 'asc', id: 'desc'}).parameters();
expect(chain).toEqual({id: 'eq.7', name: 'ilike.*foo*', order: 'name.asc,id.desc', value: ['gte.1', 'lte.2'], full_text: '@@.foo&bar&qux', deactivated_at: 'not.is.null'});
});

it("should use custom .toFilter to get value from filter getters", function() {
vm.name('foo');
vm.name.toFilter = function(){
Expand Down
2 changes: 1 addition & 1 deletion src/vms/filtersVM.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}
return memo;
}, {
order: m.prop()
order: filter()
}
),

Expand Down

0 comments on commit f4ace7f

Please sign in to comment.