aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorCaitlin Potter2014-02-11 09:57:04 -0500
committerCaitlin Potter2014-02-11 17:08:41 -0500
commitb4eed8ad94ce9719540462c1ee969dfd3c6b2355 (patch)
tree83e7074344a407168b2fa622d49f060ffe956078 /test
parent08793a690abe3eda40deae10f8a0a117779bdbd9 (diff)
downloadangular.js-b4eed8ad94ce9719540462c1ee969dfd3c6b2355.tar.bz2
feat(filterFilter): support deeply nested predicate objects
Due to 339a165, it became impossible to filter nested properties of an object using the filterFilter. A proposed solution to this was to enable the use of nested predicate objects. This change enables the use of these nested predicate objects. Example: ```html <div ng-repeat="it in items | filter:{ address: { country: 'Canuckistan'}}"></div> ``` Or ```js $filter('filter')(items, { address: { country: 'Canuckistan' } }); ``` Closes #6215 Related to #6009
Diffstat (limited to 'test')
-rw-r--r--test/ng/filter/filterSpec.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ng/filter/filterSpec.js b/test/ng/filter/filterSpec.js
index 0bb48704..7679136a 100644
--- a/test/ng/filter/filterSpec.js
+++ b/test/ng/filter/filterSpec.js
@@ -70,6 +70,17 @@ describe('Filter: filter', function() {
});
+ it('should support deep predicate objects', function() {
+ var items = [{person: {name: 'John'}},
+ {person: {name: 'Rita'}},
+ {person: {name: 'Billy'}},
+ {person: {name: 'Joan'}}];
+ expect(filter(items, {person: {name: 'Jo'}}).length).toBe(2);
+ expect(filter(items, {person: {name: 'Jo'}})).toEqual([
+ {person: {name: 'John'}}, {person: {name: 'Joan'}}]);
+ });
+
+
it('should match any properties for given "$" property', function() {
var items = [{first: 'tom', last: 'hevery'},
{first: 'adam', last: 'hevery', alias: 'tom', done: false},