From 3dfd07bb65ddcc7bbb7128557d876c9eafd6df4f Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 27 Jun 2014 19:37:03 +1000 Subject: [PATCH 1/2] test(filter): fix typo in descriptions and add test to match blank object attributes Two descriptions contain typo's to the word predicate. Also, to prove behavior in ticket 7890, create a new test to display filter Closes #7891 --- test/ng/filter/filterSpec.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/ng/filter/filterSpec.js b/test/ng/filter/filterSpec.js index fecfcf78b0c8..83989496b948 100644 --- a/test/ng/filter/filterSpec.js +++ b/test/ng/filter/filterSpec.js @@ -49,7 +49,7 @@ describe('Filter: filter', function() { expect(filter(items, function(i) {return i.done;}).length).toBe(1); }); - it('should take object as perdicate', function() { + it('should take object as predicate', function() { var items = [{first: 'misko', last: 'hevery'}, {first: 'adam', last: 'abrons'}]; @@ -61,7 +61,7 @@ describe('Filter: filter', function() { }); - it('should support predicat object with dots in the name', function() { + it('should support predicate object with dots in the name', function() { var items = [{'first.name': 'misko', 'last.name': 'hevery'}, {'first.name': 'adam', 'last.name': 'abrons'}]; @@ -81,6 +81,16 @@ describe('Filter: filter', function() { ]); }); + it('should be able to use exact match to match empty strings', function() { + var items = [{person: {name: 'John'}}, + {person: {name: 'Rita'}}, + {person: {name: 'Billy'}}, + {person: {name: ''}}, + {person: {name: 'Joan'}}]; + expect(filter(items, {person: {name: ''}}).length).toBe(5); + expect(filter(items, {person: {name: ''}}, true).length).toBe(1); + }); + it('should match any properties for given "$" property', function() { var items = [{first: 'tom', last: 'hevery'}, From d73607dbf9844392aa8cebc8c1ea1fcae40f107c Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Sat, 28 Jun 2014 09:41:31 +1000 Subject: [PATCH 2/2] test(filter): Move the new test that shows exact match on a blank object attribute to descriptor section Move the test to show matching empty string to the should support comparator section. Closes #7891 --- test/ng/filter/filterSpec.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/test/ng/filter/filterSpec.js b/test/ng/filter/filterSpec.js index 83989496b948..bbc3fc607a0a 100644 --- a/test/ng/filter/filterSpec.js +++ b/test/ng/filter/filterSpec.js @@ -81,17 +81,6 @@ describe('Filter: filter', function() { ]); }); - it('should be able to use exact match to match empty strings', function() { - var items = [{person: {name: 'John'}}, - {person: {name: 'Rita'}}, - {person: {name: 'Billy'}}, - {person: {name: ''}}, - {person: {name: 'Joan'}}]; - expect(filter(items, {person: {name: ''}}).length).toBe(5); - expect(filter(items, {person: {name: ''}}, true).length).toBe(1); - }); - - it('should match any properties for given "$" property', function() { var items = [{first: 'tom', last: 'hevery'}, {first: 'adam', last: 'hevery', alias: 'tom', done: false}, @@ -170,6 +159,15 @@ describe('Filter: filter', function() { }); + it('should be able to use exact match to match empty strings', function() { + var items = [{person: {name: 'John'}}, + {person: {name: 'Rita'}}, + {person: {name: 'Billy'}}, + {person: {name: ''}}, + {person: {name: 'Joan'}}]; + expect(filter(items, {person: {name: ''}}).length).toBe(5); + expect(filter(items, {person: {name: ''}}, true).length).toBe(1); + }); });