mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix(filter): filter on false properties
Code was evaluating !expression[key] while attempting to see if the key was present, but this was evaluating to true for false values as well as missing keys. Closes #2797.
This commit is contained in:
@@ -60,6 +60,17 @@ describe('Filter: filter', function() {
|
||||
expect(filter(items, {first:'misko', last:'hevery'})[0]).toEqual(items[0]);
|
||||
});
|
||||
|
||||
it('should support boolean properties', function() {
|
||||
var items = [{name: 'tom', current: true},
|
||||
{name: 'demi', current: false},
|
||||
{name: 'sofia'}];
|
||||
|
||||
expect(filter(items, {current:true}).length).toBe(1);
|
||||
expect(filter(items, {current:true})[0].name).toBe('tom');
|
||||
expect(filter(items, {current:false}).length).toBe(1);
|
||||
expect(filter(items, {current:false})[0].name).toBe('demi');
|
||||
});
|
||||
|
||||
it('should support negation operator', function() {
|
||||
var items = ['misko', 'adam'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user