Skip to content

Commit

Permalink
Allow falsy equalTo query. Fixes #59 (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbleigh authored Aug 23, 2016
1 parent e7239d1 commit 1c72b01
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion firebase-query.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
query = query.endAt(endAt);
}

if (equalTo) {
if (equalTo !== null) {
query = query.equalTo(equalTo);
}

Expand Down
24 changes: 24 additions & 0 deletions test/firebase-query.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,30 @@
});
});

suite('equalTo query', function() {
var query;

setup(function() {
query = fixture('BasicQuery');
query.path = root + '/equalTo';
return query.transactionsComplete;
});

test('should allow an equalTo query with a `false` value', function() {
query.orderByChild = 'thing';
query.equalTo = false;

return setFirebaseValue(query.path, {
a: {thing: true},
b: {thing: false},
c: {thing: false}
}).then(function() {
expect(query.data[0].$key).to.be.eql('b');
expect(query.data.length).to.be.eql(2);
});
});
});

suite('coordinating with dom-repeat', function() {
var query;
var domRepeat;
Expand Down

0 comments on commit 1c72b01

Please sign in to comment.